Coder Social home page Coder Social logo

Comments (2)

jkuehn avatar jkuehn commented on July 17, 2024

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.

jkuehn avatar jkuehn commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.