Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (4k points)

In mongoDB compass I am getting no result with the below filters. Not sure what I am doing wrong.

  1. {user: {uid: 'ttorone'}}
  2. {user: {_id: ObjectId("5b9fc9567a1f050026a8bbda")}}

What I want is to filter out this document (where user-> uid is 'ttorone'). User is also an object here.

1 Answer

0 votes
by (8.7k points)
edited by

There is a syntax error you should try the following one instead:

{"user.uid" : "ttorone"}

 For example, in the COVID-19 database if you have to  records for all the person whose state id is 1(Delhi) so you have to put the below filter in the compass of Mongodb as:

{"state.id" : "1"}

Want to become a Web Developer, join Web Development Courses Online Training now!

Related questions

0 votes
1 answer
asked Jan 30, 2020 in Web Technology by anmolj (9k points)
0 votes
1 answer
asked Mar 1, 2021 in Web Technology by adhiraj (4k points)
0 votes
4 answers
0 votes
1 answer
0 votes
1 answer

Browse Categories

...