How to combine AND with OR in mongoose?
问题 I realized that when in node.js I build a query such as: if (hashtagsInput != undefined) { var hashtags = hashtagsInput.split(","); for(var i=0; i<hashtags.length; i++) { query = query.or([{ 'hashtags': hashtags[i] }]); } } if (friends != undefined) { var friendsSplitted = friends.split(","); for(var i=0; i<friendsSplitted.length; i++) { query = query.or([{ 'facebook_username': friendsSplitted[i] }]); } } then the query is: ..., '$or': [ { hashtags: 'test1' }, { hashtags: 'test2' }, {