0

In my collection(collection name is "node"). And this collection contains following documents :

{
  "GEOLOCATION": {
    "GEO_CODE": [],
    "ACTIVE_GEOLOCATION": false
  },
  "META": {
    "CATEGORY": "levis",
    "DESCRIPTION": "dsad",
    "PRIVACY": "PUBLIC",
    "TEMPLATE_NAME": "A",
    "TEMPLATE_GROUP": "Product",
    "KEYWORDS": ["sda"],
    "CREATEDBY": "",
    "SUBCATEGORY": "Blue",
    "PRODUCT_TEMPLATE_TYPE": "Consumable",
    "UOM": "",
    "TEMPLATE_SUBGROUP": ""
  },
  "VARIENTS": [{
    "COMMENT": "Demo",
    "INDEX": 0,
    "NAME": "Price",
    "IS_PARENT": false,
    "DATATYPE": "Text",
    "ACCESS": "PUBLIC",
    "PARENT_VARIENT": "Parem",
    "TYPE": "PERMANENT"
  }]
}

I want do a query so that I can fetch keys form geolocation, Meta.

For example in my query I want to pass Meta and want to fetch only keys likes :

CATEGORY,DESCRIPTION, PRIVACY,TEMPLATE_NAME,TEMPLATE_GROUP.

For achieving this I run following query :

Object.keys(db.nodes.findOne())

But it shows following result :

[ "_id", "GEOLOCATION", "META", "VARIENTS" ]

Above result not expected result I want some thing like this,

expected output :

[CATEGORY,DESCRIPTION, PRIVACY,TEMPLATE_NAME,TEMPLATE_GROUP] // META object values.
Neo-coder
  • 7,715
  • 4
  • 33
  • 52
Shariq Ansari
  • 3,941
  • 1
  • 27
  • 30

1 Answers1

0

Check out variety.js
https://github.com/variety/variety

An open source project created by the output of this question on StackOverflow https://stackoverflow.com/a/10366065/131809

Community
  • 1
  • 1
Alex
  • 37,502
  • 51
  • 204
  • 332