Answer the question
In order to leave comments, you need to log in
How to get value in mongodb?
There is the following example in the off.doc:
MongoClient.connect(uri, function (err, db) {
db.collection('inventory').insertMany([
{
item: "journal", qty: 25, status: "A",
size: { h: 14, w: 21, uom: "cm" }, tags: ["blank", "red"]
},
{
item: "notebook", qty: 50, status: "A",
size: { h: 8.5, w: 11, uom: "in" }, tags: ["red", "blank"]
},
{
item: "paper", qty: 100, status: "D",
size: { h: 8.5, w: 11, uom: "in" }, tags: ["red", "blank", "plain"]
},
{
item: "planner", qty: 75, status: "D",
size: { h: 22.85, w: 30, uom: "cm" }, tags: ["blank", "red"]
},
{
item: "postcard", qty: 45, status: "A",
size: { h: 10, w: 15.25, uom: "cm" }, tags: ["blue"]
}
])
.then(function (result) {
// process result
})
var cursor = db.collection('inventory').find({ status: "D" });
db.close();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question