20

enter image description here

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.

Pradeep Singh
  • 1,094
  • 1
  • 9
  • 24

1 Answers1

38

Try like this {"user.uid" : "ttorone"}

For example if I would like to get all movies documents that have "imbd.id" equals to 1, I put the following filter in the compass, see the image below. Your situation is similar. You are searching for property value in the embedded object.

enter image description here