Suppose I have a collection with multiple documents with the following structure:
{
_id: "id12345",
objects: ["123","456", "789"]
}
Now I want to create a query where I pass an array of objects and get the count of occurrence in documents for each of the elements of the array, something like this:
input of query: ["123","321"]
output:
{
"123": 1,
"321": 0
}
I want to do this just by one query, passing an array, I know I could do this easily one by one instead of an array but that is not the purpose.