Top "Mongoose-schema" questions

Everything in the Mongoose ODM starts with a Schema.

How to select specific field in nested populate in mogoose

here is my schema: var UserSchema = new Schema({ email: String, name: String, city: String, username: String, profilePic: String, phoneNo: Number, …

mongodb mongoose mongoose-populate mongoose-schema
update schema in mongoose to add new property

I am trying to update a schema to add a new property field. I was hoping it would be as …

node.js mongodb mongoose mongoose-schema
(node:71307) [DEP0079] DeprecationWarning

Try to update MongoDB document Getting Deprecation Warning as (node:71307) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is …

javascript node.js mongodb mongoose mongoose-schema
Mongoose TypeError: User is not a constructor

I'm trying to add a subdocument to a parent schema with Mongoose and MongoDB however I'm being thrown the following …

node.js mongodb express mongoose mongoose-schema
Validate object against Mongoose schema without saving as a new document

I'm trying to validate some data that will be inserted into a new document, but not before a lot of …

node.js mongodb validation mongoose-schema
How to use mongoose model schema with dynamic keys?

i'm using mongoose with nodejs, and i need to create a dynamic schema model, this is my code: schema.add({…

node.js mongoose-schema
Preventing duplicate records in Mongoose

I'm fairly new to MongoDb / Mongoose, more used to SQL Server or Oracle. I have a fairly simple Schema for …

javascript mongodb mongoose mongoose-schema
How to create mongoose schema with array of objects

I have this json: { "data": [ "id": "1", "name": "Sample test", "description": "this is a sample test", "category": "tests", "points": 100, "startDate"​:​"2018-02…

node.js mongodb mongoose-schema
How to solve cannot read property 'push' of undefined in nodejs application?

While I am adding values to a sub document, in command prompt it shows the error like cannot read property …

node.js mongodb mongoose-schema
MongoDB / Mongoose timestamps not updating

Schema: var schema = new Schema({...}, { timestamps: true, id: false, toJSON: { virtuals: true, }, toObject: { virtual: true, } }); schema.virtual('updated').get(function () { …

node.js mongodb mongoose-schema