I am trying build a query to find the relevant warehouses based on the stateName and storageType that the manager object would have access too. I thought to use IN for the states array but then the sub-array of storage needs to match too.
This would be the manager object.
{ “id”: “managerID”, "_type": "manager" “email”:”abc@sfdf.com”, “states”: [ { “stateName”:”California”. “storage”:[ { “storageType”:”Electronics”, ”clearance”: 1 }, { “storageType”:”Clothing”, ”clearance”: 3 } ] }, { “stateName”:”Texas”. “storage”: [ { “storageType”:”Electronics”, ”clearance”: 2 }, { “storageType”:”Raw Materials”, ”clearance”: 4 } ] } ] }
These would be examples of matching results.
[ { "id": “11111”, "_type": "warehouse", "stateName": “California”, "storageType":“Electronics” }, { "id": “12222”, "_type": "warehouse", "stateName": “California”, "storageType":“Clothing” }, { "id": “13333”, "_type": "warehouse", "stateName": “Texas”, "storageType":“Electronics” } ]