How to fire mongo native queries using java-mongo-driver only.
No Spring-Data or EclipseLink or Hibernate OGM, Only using
@aaronwang4love
You can try below code.
Not tested. Don't have access to environment now. Please update if it works.
BasicDBObject query = BasicDBObject.parse("{userId: {$gt: \"1\"}}");
FindIterable dumps = crapCollection.find(query);
OR You can Also use com.mongodb.util.JSON
DBObject dbObject = (DBObject)JSON.parse("{userId: {$gt: \"1\"}}");