Check if ID exists in a collection with mongoose
问题 For instance, I have a collection User : var mongoose = require('mongoose'); var UserSchema = new mongoose.Schema({ email: String, googleId: String, facebookId: String, displayName: String, active: Boolean }); module.exports = mongoose.model('User', UserSchema); And then I have an ID: var userID = "some-user-id" What is the right way to just check if this id exists in the User collection. I don't need it to read the file or return it, I just need the true or false value. Here is one way to