0
I have a collection of documents that are nodes of a graph, where each node has its adjacency list:
{
'_id': ObjectId('547ce6f4ffaba82f360fc525'),
'adj': ['no_2'],
'nome': 'no_1'
}
{
'_id': ObjectId('547ce6f4ffaba82f360fc526'),
'adj': ['no_1', 'no_3'],
'nome': 'no_2'
}
{
'_id': ObjectId('547ce6f4ffaba82f360fc527'),
'adj': ['no_1'],
'nome': 'no_3'
}
I want the list of all documents (nodes) where the size of the adj array is greater than or equal to an X value.
I tried to solve using $gt and $size but both the operator $size only returns by exact value, when it does not seem possible to use the two operators together.
The solution (1) uses an interpreted query in all Collection documents, so it will probably be much slower than the solution (3), which is the most recommended. I have already used the solution (3) in production, no problems. It is a common practice.
– yamadapc