0
I am starting the studies with the indexes. I have a base in Mongodb where the documents have about 10 fields. Searches can be done using all these variables.
I created an index with all fields, and I thought it would work ok, but I always get a "slow query alert".
Do I need to create Dexes for all field combinations? Some of these will be in all queries.
What is the best strategy to create these Dexes? {a:1, b:1}, {a:1, b:1, c:1}...
An example document in the database (only fields that can be filtered):
{
"id": "12345",
"objectivo": 1,
"tipo": 1,
"preco": 50000,
"num_quartos": 2,
"estado": "São Paulo",
"cidade": "São Paulo",
"endereco": "Rua...",
"referencia": "12345",
"updated": 1
}
It would be good to post how Oce made his index and an example of his collection (table) so it is easier to get a response
– HudsonPH