-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.1.4
-
Component/s: CRUD
-
None
-
Environment:Windows
For the document below
{ "_id":ObjectId("5e00841f03d2a48f209b0905"), "uID":\{"ABC"},
"units":[{"locID":"11","size":"small","accessible":true,"enabled":true,"reserved":false,"occupied":false},
{"locID":"13","size":"medium","accessible":true,"enabled":true,"reserved":false,"occupied":false},
{"locID":"15","size":"large","accessible":true,"enabled":true,"reserved":false,"occupied":false}]
}
when I try to filter based on uID and units.locID I'm getting any documents
Here is the filter and option
filter: = bson.D{{"$and", bson.A{bson.D{{"uID", "ABC"}, {"units.locID", "11"}}}}}
opts := options.FindOne().SetProjection(bson.D{
, {"units", 1}})
I've tried this which gives back all units
filter: = bson.D{
{"uID", "ABC"}, {"units.locID", "11"}}
I want to get the unit which has uID = ABC and locID = 11