Skip to content
Advertisement

Tag: mongodb

Why am I getting this deprecated warning?! MongoDB

I’m working with MongoDB in NodeJS, and when the last c.getUser statement is executed (that’s to say, when I make a SECOND connectio) Mongodb outputs this warning: But I’m not using any deprecated options. Any ideas? EDIT After a little discussion with molank in the comments, it looks like open several connections from the same server is not a good

How to execute multiple mongoose queries asynchronously and wait until all of them finish executing before sending response?

Thanks in advance, but could someone explain to me how can I execute a different query for each property of my request? I am trying to create a search sidebar menu, when user changes checkbox values I create an object with these properties: I want to push a query into an array of functions and then execute them using async.parallel

Add field not in schema with mongoose

I am trying to add a new field to a document, but this isn’t working: Creating my UserModel prototype: Then calling it This successfully updates any field as long as it exists, but it won’t add any new one. Answer You can add and remove fields in schema using option { strict: false } option: strict The strict option, (enabled

How to force Mongoose to ignore __v if passed?

Working with mongoose and Express for a basic data endpoint, and I’m having trouble with the Update portion of the CRUD operations. Testing the Update path works in Postman, but when I try from my angular app, it returns this: MongoError: Updating the path ‘__v’ would create a conflict at ‘__v’ at C:Usersrutherfordc.AADocumentsGitHubtechInventorynode_modulesmongoosenode_modulesmongodb-corelibconne ctionpool.js:595:61 at authenticateStragglers (C:Usersrutherfordc.AADocumentsGitHubtechInventorynode_modulesmongoosenode_module smongodb-corelibconnectionpool.js:513:16) at Connection.messageHandler

only return document _id on mongoose .find()

I update 100’s of documents every second by pushing new data to an array in its document. To get the document of which I am going to add data to, I use the mongoose .find().limit(1) function, and return the whole document. It works fine. To help with some memory and cpu issues I have, I was wondering how I could

Advertisement