populating mongoose model not returning expected results

I have two models user and places . both models have refs to each other . I’m trying to populate the place model so that when I remove place , the place get removed from places and also from places array of user model . Place from Place model is removed successfully but why it… Read More populating mongoose model not returning expected results

How can I populate a reference within a reference with Mongoose and MongoDB

I have Posts which contains a comments reference, the comments have a user reference. I want to create a method in which I can get the user with their comment. Post: [comment_id, comment_id] Comment: [user_id] The following is what I have so far: postRouter.get(‘/:postId/comments’, (req, res, next) => { Post.findOne({ _id: req.params.postId }) .populate(‘comments’) //… Read More How can I populate a reference within a reference with Mongoose and MongoDB

how a populate works with-in populate in mongoDb?

I have created three modals for MongoDB const mongoose = require(‘mongoose’); const schema = mongoose.Schema const addCategorySchema = schema({ categoryName:{ type:String, unique:true, require:true }, category:{ type:String, default:’compose’ }, folder:[{ type:schema.Types.ObjectId, ref:’composeFolder’ }], userId:{ type:String } }, { timestamps:true } ) module.exports = mongoose.model(‘compose_category’, addCategorySchema) above modal is for category const mongoose = require(‘mongoose’); const schema… Read More how a populate works with-in populate in mongoDb?