Query for the User

Which of these queries can be used If you want to find all MongoDB users who do not have the username “John”?

a. db.users.find({"username" : {"$ne" : "John"}}) 
b. db.users.find({"username" : {"$not" : "John"}})
c. db.users.find({"username" : {"$else" : "John"}})
d. db.users.find({"username" : {"$except" : "John"}})

Skills Covered

  • MongoDB
  • Queries

Assessing

  • Fundamentals

Question Type

  • MCQs (Single Correct)

Related Posts