I'm new to Node.js. I have a collection with four documents. All documents have three fields "_id", "num" and "str".
I send the result on the page of browser
app.get('/', (req,res) => {
hwUsers.aggregate(pipeline)
.then((hwu) => {
res.send(hwu);})
.catch((err) => {
res.send(err)});
});
This is my pipeline:
let pipeline = [{
"$match": {num: 1}
},
{
"$project":{str: 1, _id: 0}
}];
This is result which i see on the page [{"str":"lo "}] My question is next. How can I take just value from field, if I can of course.