These are chat archives for Automattic/mongoose

Jul 2016
Paul "Joey" Clark
Jul 17 2016 04:24
@DylanPiercey Does this article do what you need? (I remember the built-in behaviour used to be limited to inner schemas in some way.)
If not, you may need to use a plugin:
Dylan Piercey
Jul 17 2016 23:21

@joeytwiddle I was more looking for a way to achieve what the article achieves but using only a string as the populate option.

I ended up writing a little parser that works like this, thanks for the link!

parsePopulate(Model, 'user[name posts]:posts[title]'); //-> [{
    path: 'user',
    model: ...,
    select: 'name posts',
    populate: {
        path: 'posts',
        select: 'title',
        model: ...