Reputation: 73
I am a newbie in MongoDB. Can anyone tell me how I can create a simple GeoJSON object ? I will be working with GeoSpatial queries hence I need some basic help with creating a GeoJSON object using Java Mongo driver.
Upvotes: 1
Views: 1755
Reputation: 5860
You cannot create separate GeoJSON objects using Java Driver. You will have to use query builders to produce GeoJSON queries.
Use Basicdb objects and append Geo data to the objects.
Upvotes: 1
Reputation: 1831
Try the SpringData Mongo driver. It has methods in the Criteria
object to create the kind of query you want:
The official Java driver for MongoDB is really not very good. The equivalent JavaScript commands are distributed unevenly across the Java API, and sometimes you're required to do what @Sambhav-Sharma says: just pass MongoDB operators as strings.
Upvotes: 1