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.

Find document with array that contains a specific value

If I have this schema... person = { name : String, favoriteFoods : Array } ... where the favoriteFoods array is populated with strings. How can …

mongodb mongoose
How do I update/upsert a document in Mongoose?

Perhaps it's the time, perhaps it's me drowning in sparse documentation and not being able to wrap my head around …

javascript mongodb node.js mongoose
Find MongoDB records where array field is not empty

All of my records have a field called "pictures". This field is an array of strings. I now want the …

mongodb mongoose
E11000 duplicate key error index in mongodb mongoose

Following is my user schema in user.js model - var userSchema = new mongoose.Schema({ local: { name: { type: String }, email : { …

node.js mongodb mongoose
How to sort in mongoose?

I find no doc for the sort modifier. The only insight is in the unit tests: spec.lib.query.js#…

node.js mongodb mongoose
Mongoose: findOneAndUpdate doesn't return updated document

Below is my code var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/test'); var Cat = mongoose.model('Cat', { name: String, …

node.js mongodb mongoose
Avoid "current URL string parser is deprecated" warning by setting useNewUrlParser to true

I have a database wrapper class that establishes a connection to some MongoDB instance: async connect(connectionString: string): Promise<…

node.js mongodb typescript express mongoose
Push items into mongo array via mongoose

I've scoured SO a good bit looking for the answer but I'm sure that I'm lost for the right words …

node.js mongodb express mongoose
How to define object in array in Mongoose schema correctly with 2d geo index

I'm currently having problems in creating a schema for the document below. The response from the server always returns the "…

node.js mongodb mongoose schema geo
How to paginate with Mongoose in Node.js?

I am writing a webapp with Node.js and mongoose. How can I paginate the results I get from a .…

mongodb node.js pagination mongoose