Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated mongodb docs

  • Loading branch information...
commit e8dfe6d9d6ebeb4aab50aa55f46f8b04ae947501 1 parent 66f5393
Graeme Rocher authored
View
9 grails-documentation-mongo/src/docs/guide/1.2 Release Notes.gdoc
@@ -1,5 +1,14 @@
Below are the details of the changes across releases:
+h4. 1.0 RC5
+
+* Support for direct links instead of DBRefs with reference:false in the mapping
+* Support for defining Mongo basic types as properties of a domain (Binary, DBObject etc.)
+
+h4. 1.0 RC4
+
+* Bug fixes
+
h4. 1.0 RC3
* Easy conversion of DBObject to entity methods added
View
21 ...ls-documentation-mongo/src/docs/guide/3. Mapping Domain Classes to Mongo Collections.gdoc
@@ -1,3 +1,5 @@
+h4. Basic Mapping
+
The way GORM for Mongo works is to map each domain class to a Mongo collection. For example given a domain class such as:
{code}
@@ -10,6 +12,8 @@ class Person {
This will map onto a Mongo [DBCollection|http://api.mongodb.org/java/current/com/mongodb/DBCollection.html] called "person".
+h4. Embedded Documents
+
It is quite common in Mongo to embed documents within documents (nested documents). This can be done with GORM embedded types:
{code}
@@ -33,6 +37,8 @@ class Person {
}
{code}
+h4. Basic Collection Types
+
You can also map lists and maps of basic types (such as strings) simply by defining the appropriate collection type:
{code}
@@ -48,6 +54,8 @@ new Person(friends:['Fred', 'Bob'], pets:[chuck:"Dog", eddie:'Parrot']).save(flu
Basic collection types are stored as native ArrayList and BSON documents within the Mongo documents.
+h4. Customized Collection and Database Mapping
+
You may wish to customize how a domain class maps onto a @DBCollection@. This is possible using the @mapping@ block as follows:
{code}
@@ -72,3 +80,16 @@ class Person {
}
}
{code}
+
+For non-embedded associations by default GORM for MongoDB will map links between documents using MongoDB [database references|http://www.mongodb.org/display/DOCS/Database+References] also known as @DBRefs@.
+
+If you prefer not to use DBRefs then you tell GORM to use direct links by using the @reference:false@ mapping:
+
+{code}
+class Person {
+ ..
+ static mapping = {
+ address reference:false
+ }
+}
+{code}
View
2  settings.gradle
@@ -5,7 +5,7 @@ include "grails-datastore-core",
"grails-datastore-jpa",
"grails-datastore-redis",
/* "grails-datastore-riak",*/
-// "grails-datastore-simple",
+ "grails-datastore-simple",
"grails-datastore-web",
"grails-datastore-simpledb",
"grails-datastore-dynamodb",
Please sign in to comment.
Something went wrong with that request. Please try again.