Reputation: 1948
I have a Grails application that uses Mongodb to persist domain classes. I also have some collections in Mongodb that aren't modeled after my domain classes because they are just static data like telephone codes and currency exchange rates. How do I go about accessing these collections via my code since they aren't modeled after domain classes, I cannot use GORM's finders to retrieve these data correct?
Upvotes: 0
Views: 65
Reputation: 620
GORM is not an option.
Add mongo java driver dependency in buildConfig.groovy like
runtime 'org.mongodb:mongo-java-driver:2.11.3'
, refresh your dependencies and then follow this answer of mine which shows how to access such collections from mongodb which is not modelled after domain classes.
Upvotes: 1
Reputation: 20712
The Gorm Plugin offers access to the low level API. Have a look at http://grails.github.io/grails-data-mapping/mongodb/manual/guide/4.%20Low-level%20API.html
Upvotes: 0