Reputation: 981
Given some JSON value and a query in MongoDB format, I want to filter the same way that MongoDB does, the json entities I want without going to the MongoDB.
For example, I have:
JSON Value: [{qty: 10}, {qty: 30}, {qty: 50}] Query in MongoDB format: { qty: { $gt: 20 } }
Result: [{qty: 50}]
I want that without going to Mongo database, for example calling some method that recives JSON Value and JSON Query String in Mongo format, inside some JAR.
Thanks!
Upvotes: 0
Views: 134
Reputation: 11875
I want that without going to Mongo database
Parse JSON using Jackson and create a Query
Object and a Collection
containing the target objects.
Use a collections framework such as Guava or GS-Collections and filter.
Upvotes: 1
Reputation: 14164
'Jackson' library offers JSON parsing & generation in Java. Once you've parsed, you can filter values/ data structure using Java code to your heart's content.
Java obviously has no direct implementation of Mongo query language.. you can implement Java code yourself as desired.
See:
Upvotes: 0