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
Post a Comment