Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- compile ":mongodb:3.0.3"
- //runtime ":hibernate4:4.3.6.1"
- environments {
- production {
- grails {
- mongo {
- replicaSet = [ "xxxxxxxx"]
- username = "xxxx"
- password= "xxxxxxxxxxxxxx"
- databaseName = "xxxxxx"
- }
- }
- }
- development {
- grails {
- mongo {
- replicaSet = [ "xxxxxxxx"]
- username = "xxxx"
- password= "xxxxxxxxxxxxxx"
- databaseName = "xxxxxx"
- }
- }
- }
- test {
- grails {
- mongo {
- replicaSet = [ "xxxxxxxx"]
- username = "xxxx"
- password= "xxxxxxxxxxxxxx"
- databaseName = "xxxxxx"
- }
- }
- }
- }
- package test
- class Book {
- String name
- Map authors
- static hasMany = [authors:Author]
- static constraints = {
- }
- }
- package test
- class Author {
- String name
- static constraints = {
- }
- }
- import test.*
- def a = new Author(name:"Stephen King")
- def book = new Book(name:"test")
- book.authors = ["stephen":a]
- book.save(failOnError:true)
- {
- "_id": 1,
- "name": "test",
- "version": 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement