I have a question: Suppose I have a particular field whose value is ObjectId(x) for many x, and said x corresponds to a particular userId in a different collection. I need to find patterns in my database. How can I query for whether two x's show up multiple times in documents? In other words,
{
'field' : [ObjectId(x),ObjectId(y)]
}
or
{
'field' : [ObjectId(a), ObjectId(b)]
}
or
{
'field' : [ObjectId(car), ObjectId(mouse)]
}
How can I query for whether a and b repeat in different documents or car and mouse or x and y. In other words how can I query for general patterns in the collection without actually using the Id? I apologize if I'm not being too specific. Let me know if you have questions. Thanks all!