@Test
  public void larger_than_decimal128() {
    final AdvancedRepository repo = new AdvancedRepository(context.setup());
    final ObjectId id = ObjectId.get();
    final BigInteger integer = BigInteger.valueOf(Long.MAX_VALUE).pow(4);

    try {
      new Decimal128(new BigDecimal(integer));
      fail("Should fail for " + integer);
    } catch (NumberFormatException ignore) {
      // expected
    }

    final Advanced doc = ImmutableAdvanced.builder()
            .id(id)
            .bigDecimal(new BigDecimal(integer)) // make number big
            .bigInteger(integer) // make it also big
            .atomicBoolean(new AtomicBoolean(false))
            .atomicInteger(new AtomicInteger(1))
            .atomicLong(new AtomicLong(2))
            .build();

    repo.insert(doc).getUnchecked();

    final Advanced doc2 = repo.findById(id).fetchFirst().getUnchecked().get();
    check(doc2.bigDecimal().unscaledValue()).is(integer);
    check(doc2.bigInteger()).is(integer);

  }
Serializing big numbers which can't be stored in {@link org.bson.types.Decimal128} format.
They should be serialized as strings (or binary) in mongo.
mongo/test/org/immutables/mongo/fixture/NumbersTest.java