Forum Discussion
Any help would be great regarding the above problem.
Thanks
Deepali
- Harshini7 years agoNew Contributor
Hi Deepali,
Query has to used as DB object when you put to find() method. Hope below query helps
Try the below code
try
{
BasicDBObject allQuery = new BasicDBObject();
allQuery.put("_id", "000000000001093467822SO01");DBCursor cursor =dbColl.find(allQuery);
//DBCursor cursor =dbColl.find();
JSON json =new JSON();
String serialize = json.serialize(cursor);
System.out.println(serialize);
//List list1 = new ArrayList();
while(cursor.hasNext())
{
def var = cursor.next()
log.info "Party id $var"
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}Harshini Kasa
- Harshini7 years agoNew Contributor
Hi Deepali,
Query has to used as DB object when you put to find() method. Hope below query helps
Try the below code
try
{
BasicDBObject allQuery = new BasicDBObject();
allQuery.put("_id", "000000000001093467822SO01");DBCursor cursor =dbColl.find(allQuery);
//DBCursor cursor =dbColl.find();
JSON json =new JSON();
String serialize = json.serialize(cursor);
System.out.println(serialize);
//List list1 = new ArrayList();
while(cursor.hasNext())
{
def var = cursor.next()
log.info "Party id $var"
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Related Content
- 6 months agosohailalam2696