Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Support for MongoDB 3.4 big decimals. Fixes grails/grails-data-mappin…
- Loading branch information
Showing
with
167 additions
and 8 deletions.
- +1 −1 .travis.yml
- +16 −0 ...atastore-gorm-bson/src/main/groovy/org/grails/datastore/bson/codecs/decoders/SimpleDecoder.groovy
- +13 −2 ...atastore-gorm-bson/src/main/groovy/org/grails/datastore/bson/codecs/encoders/SimpleEncoder.groovy
- +27 −1 grails-datastore-gorm-mongodb/src/main/groovy/grails/mongodb/MongoEntity.groovy
- +17 −0 grails-datastore-gorm-mongodb/src/main/groovy/grails/mongodb/api/MongoStaticOperations.groovy
- +29 −1 ...-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/gorm/mongo/api/MongoStaticApi.groovy
- +10 −2 ...e-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/config/MongoMappingContext.java
- +7 −0 ...roovy/org/grails/datastore/mapping/mongo/connections/AbstractMongoConnectionSourceSettings.groovy
- +1 −1 ...s-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/query/MongoQuery.java
- +9 −0 grails-datastore-gorm-mongodb/src/test/groovy/grails/gorm/tests/FindNativeSpec.groovy
- +36 −0 grails-datastore-gorm-mongodb/src/test/groovy/org/grails/datastore/gorm/mongo/BigDecimalSpec.groovy
- +1 −0 grails-datastore-gorm-mongodb/src/test/groovy/org/grails/datastore/gorm/mongo/TestSearchSpec.groovy
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
@@ -9,7 +9,7 @@ addons: | ||
apt: | ||
sources: | ||
- mongodb-upstart | ||
- mongodb-3.4-precise | ||
packages: | ||
- mongodb-org-server | ||
- mongodb-org-shell | ||
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
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
@@ -0,0 +1,36 @@ | ||
package org.grails.datastore.gorm.mongo | ||
|
||
import grails.gorm.annotation.Entity | ||
import grails.gorm.tests.GormDatastoreSpec | ||
import grails.mongodb.MongoEntity | ||
import groovy.transform.NotYetImplemented | ||
import org.bson.Document | ||
import org.bson.types.Decimal128 | ||
import spock.lang.Ignore | ||
import spock.lang.IgnoreIf | ||
|
||
/** | ||
* Created by graemerocher on 14/12/16. | ||
*/ | ||
class BigDecimalSpec extends GormDatastoreSpec { | ||
|
||
void "test save and retrieve big decimal value"() { | ||
when:"A big decimal is saved" | ||
def val = new BigDecimal("1.0") | ||
new BossMan(salary: val).save(flush:true) | ||
session.clear() | ||
BossMan bm = BossMan.first() | ||
then:"" | ||
bm.salary == val | ||
|
||
} | ||
|
||
@Override | ||
List getDomainClasses() { | ||
[BossMan] | ||
} | ||
} | ||
@Entity | ||
class BossMan implements MongoEntity<BossMan> { | ||
BigDecimal salary | ||
} |
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
@@ -44,6 +44,7 @@ class TestSearchSpec extends GormDatastoreSpec{ | ||
|
||
@Entity | ||
class Product implements MongoEntity<Product>{ | ||
|
||
ObjectId id | ||
String title | ||
|
||