java - How to retrieve a value from mongoDB? -


i new mongodb , using java mongodb. have json want retrieve column names , not value.i need store in 2 different array.

desired output is:

column [ ] = views, addtocart, addtowishlist, zoomedproductimage

list [ ] = fsymbol, num, operator

and json:

{     "views": {         "fsymbol": "",         "num": 0.1,         "operator": "*"     },     "addtocart": {         "fsymbol": "+",         "num": 0.15,         "operator": "*"    },    "addtowishlist": {        "fsymbol": "+",         "num": 0.1,        "operator": "*"    },    "zoomedproductimage": {        "fsymbol": "+",        "num": 0.07,        "operator": "*"    }    } 

try keyset() method.

basicdbobject searchquery = new basicdbobject(); dbcursor cursor = table.find(searchquery);  while (cursor.hasnext()) {     system.out.println(cursor.next().keyset()); } 

check docs


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -