DATAMONGO-1517 - Add support for Decimal128 BSON type.

Support Decimal128 as Mongo simple type if present. Decimal128 is stored as NumberDecimal.

class Person {

  String id;
  Decimal128 decimal128;

  Person(String id, Decimal128 decimal128) {
    this.id = id;
    this.decimal128 = decimal128;
  }
}

mongoTemplate.save(new Person("foo", new Decimal128(new BigDecimal("123.456"))));

is represented as:

{ "_id" : "foo", "decimal128" : NumberDecimal("123.456") }
This commit is contained in:
Mark Paluch
2017-01-03 14:37:47 +01:00
committed by Oliver Gierke
parent d2d162dee6
commit 8e3d7f96c4
3 changed files with 60 additions and 2 deletions

View File

@@ -126,6 +126,10 @@ In addition to these types, Spring Data MongoDB provides a set of built-in conve
| native
| `{"value" : { … }}`
| `Decimal128`
| native
| `{"value" : NumberDecimal(…)}`
| `AtomicInteger` +
calling `get()` before the actual conversion
| converter +