Answer the question
In order to leave comments, you need to log in
Is it possible to select values from MongoDB without repeats?
There is a collection with objects that have the city property, conditionally: There are a "city" : "Анапа"
lot of objects, the names of cities are different, but repeated.
I want to make an array variable of these values on the server. Instead: city = ['Анапа', 'Сочи', ...]
Write
city = function* () {
yield db.collection('collection_name').find({},{"_id": 0, "city": 1}).toArray();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question