javascript - How to get all fields in a same level in embedded documents in MongoDB -
Thanks to the embedded documents, we do not have to join the operation.
However, I need to get it
Is there any easy way to get all the fields at the same level?
For example; I want to prepare a report with all the following areas, in this situation, I need to get all the JSON data at the same level. {"_id": "1", "date": "2014-07-30 02:00", "customer": {"_id": "14", "name" : "Name": "xxxx stackton", "address": {"city": "nevercity", "province": "neverland"}}, "customer": {"_id": "473", "xxxx Jordan" }, "Payment": {"method": "cash", "zodiac": "67.40"}} >
You can iterate object keys as a JSON object
sample name
and age below
var myObj = {name: 'Tom', age: 21}; (Key in myObj) {print (key); }
Comments
Post a Comment