These are chat archives for Automattic/mongoose

16th
Jul 2016
Alann Sapone
@devoluti0n
Jul 16 2016 07:52
Sorry, had to leave :'(
The project looks like I wish it looks
{
"_id" : ObjectId("57891fbcb753c9b8213e79c8"),
"owner" : ObjectId("5767dd5582276fcc168d4d69"),
"created" : ISODate("2016-07-15T17:39:08.903Z"),
"components" : [
ObjectId("57892019a7b0ae142238d548")
],
"assistants" : [],
"description" : "",
"name" : "Test",
"__v" : 4
}
I think I'll stick with the pre-save hook to save children before I save the parent
Martin Reynolds
@Hobbit71
Jul 16 2016 07:58
Which seems right way of doing. There is no short cut
Alann Sapone
@devoluti0n
Jul 16 2016 08:02
Really, thank you a lot for your help !
I really appreciate :) !
Martin Reynolds
@Hobbit71
Jul 16 2016 08:51
No worries. It was fun. 😄
Dylan Piercey
@DylanPiercey
Jul 16 2016 15:27

Is there a way to represent a 'nested' populate query with a string and or a 'select' populate query with a string?

I am building an api with a populate option using mongoose and am curious if this is already built in.

Model.find().populate('user user.posts')

// vs

Model.find().populate({ 
     path: 'user',
     populate: {
       path: 'posts',
       model: 'Post'
     } 
  })