I am trying to query a MongoDB for some specific fields from express.js. I have tried several approaches, but without success, including the suggestions found here. I have indeed tried as examples the following (and a few more variations):
db.collection("Items").find({}, { Name : 1, Price : 1 }, (err, result) => {
if (result) {
console.log(result)
}
})
Or
db.collection("Items").aggregate( { $project : { Name : 1, Price : 1 } }, (err, result) => {
if (result) {
console.log(result)
}
})