Top "Mongoose" questions

Mongoose is a MongoDB object modeling tool, or ODM (Object Document Mapper), written in JavaScript and designed to work in an asynchronous environment.

How to access a preexisting collection with Mongoose?

I have a large collection of 300 question objects in a database test. I can interact with this collection easily through …

mongodb node.js express mongoose
How do you turn a Mongoose document into a plain object?

I have a document from a mongoose find that I want to extend before JSON encoding and sending out as …

node.js mongoose
How can I generate an ObjectId with mongoose?

I'd like to generate a MongoDB ObjectId with Mongoose. Is there a way to access the ObjectId constructor from Mongoose? …

node.js mongodb mongoose
MongoDB via Mongoose JS - What is findByID?

I am writing a NodeJS server with ExpressJS, PassportJS, MongoDB and MongooseJS. I just managed to get PassportJS to use …

mongodb mongoose
Properly close mongoose's connection once you're done

I'm using mongoose in a script that is not meant to run continuously, and I'm facing what seems to be …

node.js mongodb mongoose
Mongoose.js: Find user by username LIKE value

I like to to go find a user in mongoDb by looking for a user called value. The problem with: …

javascript node.js mongodb find mongoose
Mongoose (mongodb) batch insert?

Does Mongoose v3.6+ support batch inserts now? I've searched for a few minutes but anything matching this query is a …

node.js mongodb mongoose
How do I limit the number of returned items?

myModel.find({}, function(err, items) { console.log(items.length); // Big number }); How can I limit the returned items to only …

mongoose
How can I save multiple documents concurrently in Mongoose/Node.js?

At the moment I use save to add a single document. Suppose I have an array of documents that I …

node.js mongodb mongoose
How to return a complex JSON response with Node.js?

Using nodejs and express, I'd like to return one or multiple objects (array) using JSON. In the code below I …

json node.js express mongoose