I have in my mongoDB more than 50000 entries with an ID (in one collection).
I would like to get only the ID (and not the other infos).
In server.js, I connect to mongoDB via mongoose:
mongoose.connect('mongodb://10.3.5.12/mydb');
I need to iterate all the 50 000 entries to check the ID, check the duplicates and store in a list.
Do I need to create a controller? It will be very heavy with 50 000 entries? Any idea how I can proceed?
var listId= [];
...
listId.push(id);
[EDIT] Could I try something like that with mongoose?
MyModel.find().distinct('id', function(error, id) {
// ids is an array of all ObjectIds
var listId= [];
...
listId.push(id);
});
Thanks for your help!