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

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -