Comments (2)
Hi there,
it is planned to implement criteria queries for the mongodb-morphia plugin, which will support $or and $where queries. Currently your only way is to use morphia directly for such queries. Like this:
class TestController {
def mongo // get the mongo handler injected
def testMorphiaQuery() {
Query q = mongo.datastore.createQuery(Car.class)
q.where("this.name == 'X1' || (this.passenger && this.passenger.name == 'Joe')")
println q.asList()
}
}
mongo.datastore will return a configured AdvancedDatastore (http://morphia.googlecode.com/svn/site/morphia/apidocs/index.html) from morphia. Hope that helps
from gorm-mongodb.
Also check out the new query method, which gives more convenient access to morphias query api:
With 0.7.5 you can do:
def list = TestDomain.query([max:100]) {
where("this.obj1.obj2.obj3 == 'dud' || this.obj1.obj2 == 'notdud'")
}.asList()
see http://jkuehn.github.com/gorm-mongodb/ref/Domain%20Classes/query.html
from gorm-mongodb.
Related Issues (11)
- Extending Classes raised MultipleId complaint HOT 2
- Runtime Error HOT 1
- Domain.list() return MorphiaIterator when GORM semantics are slightly different HOT 1
- Getting an error when trying a simple Domain Class
- Trying to use generated scaffolding causes error
- errorr in the install script HOT 1
- Unable to resolve class HOT 1
- did it support "unique" save? HOT 2
- Getting exception "com.mongodb.BasicDBObject cannot be cast to com.mongodb.DBRef" HOT 2
- (obvious) Don't think this is working with Grails 1.4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gorm-mongodb.