'Search the whole database all the keys and the valuese with Moongose
So what I want to do is search all collections in my mongodb, for example, cars, users, cities, so all those collection to be searched all the keys and values so I can send to the front and manipulate, so collect all collections, search them all and return the founded field.
I found this one: (but it seems that searches only the country, I want to search all keys available that are string.
let models = [];
models.push(mongoose.models.someCollection1);
models.push(mongoose.models.someCollectionN);
return Promise.all(
models.map((model) => model.find({ country: 'd' }))
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
