A
A
Arthur2018-04-20 11:05:03
MongoDB
Arthur, 2018-04-20 11:05:03

Sampling from a MongoDB database?

Good afternoon, I just started working with this database and there was a problem with the selection

Db.collection("xxx").findOne({ user: xxx, password: yyy },{title: 1}, (err, result) => {}

I expect only the title field in the response, but I get everything, what's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2018-04-20
@ART_CORP

the fields to be selected must be in the options object in the projection property
mongodb.github.io/node-mongodb-native/3.0/api/Coll...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question