-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Calling forEach on a database and setting/updating the database that was called for the forEach loop causes the forEach loop to repeat until watchdog terminates the code. I assume this is because it adds a new element to the database, and the forEach then sees that as a new element and calls itself again.
Expected behavior
The forEach should terminate- the workaround for this is to push all altered database elements to temporary storage, then setting each element outside of the loop. If this is how it is meant to be used, please let me know.
Screenshots
Using the following, triggered from a chat command:
const Db = new JaylyDB('Testing');
Db.set('Test', 0);
Db.forEach(variable => {
console.warn(variable);
variable++;
Db.set('Test', variable);
})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
