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.

add created_at and updated_at fields to mongoose schemas

Is there a way to add created_at and updated_at fields to a mongoose schema, without having to pass …

node.js mongodb express mongoose
mongoError: Topology was destroyed

I have a REST service built in node.js with Restify and Mongoose and a mongoDB with a collection with …

node.js mongodb mongoose restify pm2
Mongoose: CastError: Cast to ObjectId failed for value "[object Object]" at path "_id"

I am new to node.js, so I have a feeling that this will be something silly that I have …

node.js mongodb mongoose
What is the "__v" field in Mongoose

I'm using Mongoose version 3 with MongoDB version 2.2. I've noticed a __v field has started appearing in my MongoDB documents. Is …

node.js mongodb mongoose
Mongoose's find method with $or condition does not work properly

Recently I start using MongoDB with Mongoose on Nodejs. When I use Model.find method with $or condition and _id …

mongodb node.js mongoose
JavaScript OOP in NodeJS: how?

I am used to the classical OOP as in Java. What are the best practices to do OOP in JavaScript …

javascript node.js oop inheritance mongoose
Referencing another schema in Mongoose

if I have two schemas like: var userSchema = new Schema({ twittername: String, twitterID: Number, displayName: String, profilePic: String, }); var User = …

javascript mongodb mongoose
Uploading images using Node.js, Express, and Mongoose

Please consider newer answers that have more up-to-date information as things have changed over the years! Since many new Node.…

node.js image file-upload express mongoose
Mongoose, update values in array of objects

Is there a way to update values in an object? { _id: 1, name: 'John Smith', items: [{ id: 1, name: 'item 1', value: …

node.js mongodb mongoose
How to use mongoose findOne

I have the below schema (apologies that it is in coffeescript) Schema = mongoose.Schema AuthS = new Schema auth: {type: String, …

node.js mongodb coffeescript mongoose