I am looking for some help as to how to update a specific object value within an array using NeDB.
I am creating a Node.js web app that needs to use NeDB as it's database. Not sure if you need this info, but I also have the following dependencies in the package.json file:
bcrypt: ^5.1.0, body-parser": ^1.20.2, connect-ensure-login: ^0.1.1, dotenv: ^16.0.3, express": ^4.18.2, express-session: ^1.17.3, jquery: ^3.6.4, mustache-express: ^1.3.2, nedb: ^1.8.0, nodemon: ^2.0.22, passport: ^0.6.0, passport-local: ^1.0.0, path: ^0.12.7
In essence the NeDB database allows users to sign up and follows this template for each entry:
{username: username, password: password, achievements: [{name: name, type: type, achieved: achieved}, {name: name, type: type, achieved: achieved}, {name: name, type: type, achieved: achieved}]}
I want to be able to access a specific user and update the achieved value of a specific achievement.
For example I have the following users in the database, and I want to update userOne's achievement one achieved value. How would I go about doing this?
{username: userOne, password: password, achievements: [{name: one, type: type, achieved: achieved}, {name: two, type: type, achieved: achieved}, {name: three, type: type, achieved: achieved}]}
{username: userTwo, password: password, achievements: [{name: one, type: type, achieved: achieved}, {name: two, type: type, achieved: achieved}, {name: three, type: type, achieved: achieved}]}
I have tried using dot notation and object notation and had expected that to work, but nothing changed. I tried to find someone else who was having the same issue as me, but I have hit a dead end.
Thanks in advance for any help!