Skip to content

Tag: mongodb

How can I save checkbox state to my database?

I’m trying to create a Todo-list app using (nodejs,ejs…) so for every todo I create a checkbox. If someone finishes his job and uses the button bin recycle to delete it, I save that using MongoDB but I’ve a problem when checking. When I reload the page this checked box disappears. In other w…

mongoose.connect() is undefined

I’m trying to connect to my MongoDB using Mongoose and it gives me the following error. I get this Error Answer You should change 2 things: Change { mongoose } with mongoose Remove useNewUrlParser option. New version of Mongoose does not accept it as option and it will throw an error.

Destructuring a mongoose document

Using mongoose in my project, I ran into a problem. I want to find all documents that have such a key and value pair role: USER. I can get a list of documents, but I cannot get the values of specific fields from it, no matter how I try. Here is my code: The request definitely gets the document, because

mongodb collection uuid how to update?

How to create collection in mongodb with specific uuid or update the uuid ? Adding details: When I create a collection mongodb generate automatically uuid and if this is replicaSet the uuid is replicated to all SECONDARY members via the oplog: But I would like to know if there is an option this UUID to be cre…