0

so my question is. Is it possible to query a document for multiple values example

            var channelLinked = {'channel 1': '' || 'channel 2': ''}
            db1.collection('proxies').find(channelLinked).toArray(function(err,result){
              console.log(result);
              db.close()
            })

i know the above code is invalid but thats the only example i can think of.

1 Answer 1

3

You can use $or operator

The $or operator performs a logical OR operation on an array of two or more expressions and selects the documents that satisfy at least one of the expressions.

 db1.collection('proxies').find({ $or: [ { 'channel 1': 'abc' }, { 'channel 2': 'abc'} ] }).toArray(function(err,result){
          console.log(result);
          db.close()
        })

There are multiple Logical Query operators available ($and,$not,$nor)

Sign up to request clarification or add additional context in comments.

1 Comment

thank you i had figured it out before the post but you are 100% correct

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.