Just to give an update for Mongoose 3.x:
MyModel.find().distinct('_id', function(error, ids) {
// ids is an array of all ObjectIds
});
More Related Contents:
- Node.js Mongoose.js string to ObjectId function
- How to paginate with Mongoose in Node.js?
- mongoDB/mongoose: unique if not null
- Mongoose Unique index not working!
- How do you use Mongoose without defining a schema?
- How to access a preexisting collection with Mongoose?
- MongoDB password with “@” in it
- How to return Mongoose results from the find method?
- MongoDB: output ‘id’ instead of ‘_id’
- How can I update multiple documents in mongoose?
- Mongoose’s find method with $or condition does not work properly
- Delete a key from a MongoDB document using Mongoose
- Can’t find documents searching by ObjectId using Mongoose
- MEAN app vs. Mongo service local in Angular2
- MongoDB, remove object from array
- Mongoose, update values in array of objects
- Setting expiry time for a collection in mongodb using mongoose
- MongoDB/Mongoose querying at a specific date?
- Mongoose/mongoDB query joins.. but I come from a sql background
- Bulk upsert in MongoDB using mongoose
- How to set limit for array size in Mongoose schema
- Does Mongoose support the Mongodb `findAndModify` method?
- MongooseError – Operation `users.findOne()` buffering timed out after 10000ms
- Connecting Heroku App to Atlas MongoDB Cloud service
- How to set _id to db document in Mongoose?
- how to use populate and aggregate in same statement?
- Mongoose Not Creating Indexes
- Mongoose nested query on Model by field of its referenced model
- MongoDB count() versus countDocuments()
- Create unique autoincrement field with mongoose [duplicate]