Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose virtual populate paginat

Post.find({})
.populate([
    // here array is for our memory. 
    // because may need to populate multiple things
    {
        path: 'user',
        select: 'name',
        model:'User',
        options: {
            sort:{ },
            skip: 5,
            limit : 10
        },
        match:{
            // filter result in case of multiple result in populate
            // may not useful in this case
        }
    }
])
.exec((err, results)=>{
   console.log(err, results)
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #virtual #populate #paginat
ADD COMMENT
Topic
Name
3+6 =