I have an array of customers, for each customer there is an object (which is a reference to that object) of action. For each action I have status, which is a number between 1 to 7.
I want to search all customers, find the ones which the actions array it not empty and then check if status in one of the objects equals 4 or 5.
First when using the Customer.find i’ve added populate(‘actions’) to it, so instead of the objects reference it will return the object (which he does)
Then I tried these 2 queries, but none of them return anything:
Adding some sample document along your description will help greatly.
If I understand you correctly then I can think of a couple of queries, however the first query worked on the data I created so I may indeed be misunderstanding.
It didn’t worked, this how the objects looks like:
In the example it’s working, but on the db itself, it does not return any results.
Does the fact that the Action object is connected to the customer using a reference may suggest the issue? Even when populating the .find on customers with ‘actions’?