Quering embedded documents regardless of the field order

I’ve read the documentation about querying embeded documents

And there, with the example they propose, thay show a query to find nested objects but only if the fields are given in the correct order.

db.inventory.find( { size: { h: 14, w: 21, uom: "cm" } } )

Is is possible to perform that query regardless of the order or the fields? in that casa, how would the query look like?

You would have to use the dot notation. It is explained a little bit later in the link you posted.

So while:

db.inventory.find(  { size: { w: 21, h: 14, uom: "cm" } }  )

gives no result. The following will:

db.inventory.find( { "size.w" : 21 , "size.h" : 14 , "size.uom" : "cm"  }  )

Thanks, @steevej for helping out @Miguel_Coronado.

If you still have any questions feel free to mention them down here. We would be happy to help.