projection not working with find query

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();

Leave a Comment