0
I have 3 collections
in Mongodb being two lists containing only one unique identifier and in collection
remaining the unique identifier, name and surname. What I need to do is a query that is sorted by priority: who is on lista1
comes first, then who’s in lista2
and finally what is not only in the document of 3 fields. Someone can help me?
UPDATE: putting everything together in the same Collection is not an option, and in SQL it is done this way https://www.db-fiddle.com/f/do7HsPcFxvohS7TBth7Kmz/1
Hello, welcome to the site! Try to add examples of documents in your question, it is easier to understand what you need. A question that occurred to me here: what is the need to keep these data in three separate Ollections?
– Jorge C. Bernhard Tautz
So Jorge, I’m very beginner in Mongo I’ll call list 1 the highest priority list 2 the second highest priority is the last the list, list 1 and 2 have only one field, which is let’s assume the CPF, whereas list 3 has CPF, name and surname, so I want to search the name Astolfo, will return me all occurrences of Astolfo, only that I wish that if any Astolfo has his number on the list 1 it appears first, so on
– Fabiano