Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* easy access query interface
- Loading branch information
Juri Kuehn
committed
Oct 22, 2011
1 parent
aba39d6
commit 9c1cb5b
Showing
13 changed files
with
818 additions
and
650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,8 +1,8 @@ | |||
#Grails Metadata file | #Grails Metadata file | ||
#Thu Oct 13 18:24:25 CEST 2011 | #Sat Oct 22 14:08:52 CEST 2011 | ||
app.grails.version=2.0.0.M2 | app.grails.version=2.0.0.RC1 | ||
app.name=mongodb-morphia | app.name=mongodb-morphia | ||
app.version=0.7.4 | app.version=0.7.5 | ||
plugins.hibernate=2.0.0.M2 | plugins.hibernate=2.0.0.RC1 | ||
plugins.release=1.0.0.RC3 | plugins.release=1.0.0.RC3 | ||
plugins.tomcat=2.0.0.M2 | plugins.tomcat=2.0.0.RC1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
h1. query | |||
|
|||
h2. Purpose | |||
|
|||
Finds all of the domain class instances using morphias "query":http://morphia.googlecode.com/svn/site/morphia/apidocs/com/google/code/morphia/query/QueryImpl.html | |||
|
|||
h2. Examples | |||
|
|||
{code:java} | |||
// get a query instance for Book class | |||
def query = Book.query() | |||
|
|||
// get a query instance for Book class, precofigured with pagination params | |||
def query = Book.query(params) | |||
|
|||
// pass a closure that will be executed in query context | |||
def query = Book.query([sort: "releaseDate", order: "desc"]) { | |||
field('author').equal("Steven King") | |||
field('title').startsWith("The") | |||
} | |||
|
|||
// pass a closure only | |||
def query = Book.query() { | |||
field('author').equal("Steven King") | |||
field('title').startsWith("The") | |||
offset(10) | |||
}.asList() | |||
|
|||
// work with query object | |||
def query = Book.query() | |||
query.field('author').equal("Steven King") | |||
query.field('title').startsWith("The") | |||
query.offset(10) | |||
|
|||
|
|||
// Query interface provides many methods for returning the results | |||
query.asList() // return matched results as List | |||
query.get() // return first result | |||
for (Book book in query) { ... } // query implements the Iterable interface | |||
|
|||
{code} | |||
|
|||
h2. Description | |||
|
|||
{code:java} | |||
Book.query( ) | |||
Book.query( Map params ) | |||
Book.query( Map params, Closure config ) | |||
{code} | |||
|
|||
Parameters: | |||
|
|||
* @params@ - A Map containing parameters @max@, @offset@, @sort@, @order@ and @validation@ (to turn off morphia mapping validation) | |||
* @config@ - A closure that will be executed in context of Query | |||
|
|||
Returns: | |||
|
|||
Instance of a "QueryImpl":http://morphia.googlecode.com/svn/site/morphia/apidocs/com/google/code/morphia/query/QueryImpl.html |
Oops, something went wrong.