MongoDB Query in Java, search/find in nested object

前端 未结 4 1880
猫巷女王i
猫巷女王i 2021-01-19 13:16

I\'m having a little trouble with a query in Java on a MongoDB.

I have the follow structure in the database:

            {
              \"_id\" : Ob         


        
4条回答
  •  广开言路
    2021-01-19 13:42

    With MongoDB Java Driver v3.2.2 you can do something like this:

    FindIterable iterable = collection.find(Document.parse("{\"status.name\": \"Expired\"}"));
    

    This returns all documents containing "Expired" in the status.name nested field.

提交回复
热议问题