Projection doesn’t work with the new nodejs mongodb driver… Instead you will have to use .project()
cursor method here
this.database.collection('users')
.find({ "email": "value3" })
.project({ "password": 0 })
.toArray();
More Related Contents:
- Unable to delete data from mongoDB
- collection is not defined in mongodb
- E11000 duplicate key error index in mongodb mongoose
- Mongoose: findOneAndUpdate doesn’t return updated document
- Populate nested array in mongoose
- Why does mongoose always add an s to the end of my collection name
- Cannot overwrite model once compiled Mongoose
- Mongoose Schema hasn’t been registered for model
- Mongoose findByIdAndUpdate not returning correct model
- TypeError: db.collection is not a function
- Mongoose duplicate key error with upsert
- How can I use a cursor.forEach() in MongoDB using Node.js?
- MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
- Mongoose update without callback
- Model.find().toArray() claiming to not have .toArray() method
- MongoError: connect ECONNREFUSED 127.0.0.1:27017
- Difference between MongoDB and Mongoose
- How can I save multiple documents concurrently in Mongoose/Node.js?
- Mongoose: CastError: Cast to ObjectId failed for value “[object Object]” at path “_id”
- Model.find() returns empty in mongoose [duplicate]
- Setting up singleton connection with node.js and mongo
- log all queries that mongoose fire in the application
- Combine two OR-queries with AND in Mongoose
- Node.js + MongoDB: insert one and return the newly inserted document
- Mongoose – finding subdocuments by criteria
- Mongoose findOneAndUpdate and runValidators not working
- Mongoose select fields to return from findOneAndUpdate
- mongoose recursive populate
- Heroku app crashes after MongoDB updated to 3.0
- Error at connecting to MongoDb Atlas Server