A
A
Andrey Okhotnikov2020-02-11 12:19:06
MongoDB
Andrey Okhotnikov, 2020-02-11 12:19:06

Return not all fields from Mongo?

I need to get a list of users from the database, but I need to return to the front from the data without the password fields and some others. How to write a query with field exclusion in mongoose?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-02-11
@tsepen

User.find({ /* фильтр */ }, '-password -field')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question