Answer the question
In order to leave comments, you need to log in
Is it possible to filter objects that came with MongoDB?
Please tell me, I receive data from MongoDB
[{
"_id": "61014061f992e20021e7ccaf",
"email": "[email protected]",
"username": "test",
"password": "$2a$12$y3ujbKJ4MugN6EvHNqNA.uTMSCejpTzwMT4jN8Imd5beTqlF6M4eO",
"__v": 0
}, {
"_id": "61013f817e9fd3ffdf9c150a",
"email": "[email protected]",
"username": "test1",
"password": "$2a$12$0TNS6fueOBpUtzWhcHSecOlu3./uvK1kjcaznwCLuRVOTgoHpU1Um",
"__v": 0
}
]
Answer the question
In order to leave comments, you need to log in
Project Fields to Return from Query
or via
Model.find()
const cursor = db
.collection('users')
.find({ email: '[email protected]' })
.project({ password: 0, __v: 0 }); // 0 означает исключить
// или через модель
someModel.find({}, { password: 0, __v: 0 }).then(console.log);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question