Complex publish with conditionals

hi! my collections have a field “publicado”: true, when is true, all users can see the element. is the way how i can moderate mi “blog”. but, i need this:

when a user create a element, this user can see that element but only elements pending of approval created by him.

 armas.find({'Autor': this.userId , 'publicado': false});

but i need too all the another elements for this collections contain publicado : true

  armas.find({'publicado': true`})

I tried whit a return like 2 collections, but i can. any clue?

Using the $or query operator, you could do something like…

armas.find({
    $or: [
        { Autor: this.userId, publicado: false },
        { publicado: true }
    ]
});
2 Likes

good!, is just i need!

1 Like