let time = "12:00";
"10:00": {
name: "john",
status: "registered"
},
"11:00": {
name: "jane",
status: "pending"
},
"12:00": {
name: "joe",
status: "denied"
}
how to find()
the data in mongodb by its dynamically changing key variable (time
in this case)? also how to access the name key afterwards like in plain javascript (someVar[time].name
) as with the results of find().toArray
I can't really do that ... and storedJson[2].name
after storedJson = JSON.parse(JSON.stringify(result))
storing the result of dbo.collection(someCollection).find({}, { projection: { _id: 0} }).toArray ( (err, result)
seems a bit off and not how this should be done ... (also curious if it unwise saving data that way - and would therefore be open for an suggested alternative)
EDIT:
time: [time],
content: {
name: "john",
status: "pending"
}
this also isn't really a case since as I'm struggling grasping the .toArray
which forces me to do someVar[0].content.name
instead of someVar[time].content.name
Comments
Post a Comment