N
Navneet Mathpal
cursor is not going inside the while why??
public void fetch_data() throws Exception
{
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("relevancy_data");
DBCollection collection = db.getCollection("relevancy");
BasicDBObject andQuery = new BasicDBObject();
List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
obj.add(new BasicDBObject("Platform","ElasticSearch"));
obj.add(new BasicDBObject("Enviroment", "Developer"));
obj.add(new BasicDBObject("Test_name", "Search_apple"));
andQuery.put("$and", obj);
System.out.println(obj.size());
//System.out.println(andQuery.toString());
DBCursor cursor = collection.find(andQuery);
while (cursor.hasNext()) {
System.out.println("inside of while");
System.out.println(cursor.next());
}
System.out.println("outside of while");
}
public void fetch_data() throws Exception
{
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("relevancy_data");
DBCollection collection = db.getCollection("relevancy");
BasicDBObject andQuery = new BasicDBObject();
List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
obj.add(new BasicDBObject("Platform","ElasticSearch"));
obj.add(new BasicDBObject("Enviroment", "Developer"));
obj.add(new BasicDBObject("Test_name", "Search_apple"));
andQuery.put("$and", obj);
System.out.println(obj.size());
//System.out.println(andQuery.toString());
DBCursor cursor = collection.find(andQuery);
while (cursor.hasNext()) {
System.out.println("inside of while");
System.out.println(cursor.next());
}
System.out.println("outside of while");
}