I am trying to come up with a concept to take a query string and have it passed into something like this via a query object:
returnList = mongoTemplateTracking.find(query,TrackingData.class, COLLECTION_NAME);
I've been looking at the constructors of both the Query and Criteria classes to see if they could take a raw string such as:
"ID" : "32399a"
Instead of building up the Criteria object via Criteria.where().is() etc..
I have seen the method
protected <T> List<T> doFind(String collectionName,
com.mongodb.DBObject query,
com.mongodb.DBObject fields,
Class<T> entityClass)
However as I am autowiring the mongoTemplateTracking into my class I cannot access this method.
JSON.parse(json) was deprecated. use this code:
String s = "{\"$or\": [ {\"name\": \"buzz\"}, {\"age\": {\"$lt\": 20 }} ] }";
Bson bson = BasicDBObject.parse( json );
collection.find(bson);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With