Use the following commands to build run the application:
$ mvn clean package
$ java -jar target/livelessons-data-mongodb-1.0.0-SNAPSHOT.jarThe same domain to the JPA sample is used with this demo. Rather than being a @Entity
the Car here is a @Document. It has also been updated with a position (the
geo-location where the car is stored).
The CarRepository works in the same way as any Spring Data repository and has the
familiar findByMakeIgnoringCase method. The demo also includes a findByPositionNear
method which shows how you can use MongoDB’s geo features.
The DataMongoDBApplication show how queries are executed and how you can also use
MongoDB’s GridFS to store blob data.