public static ObjectId insertedId(@Nonnull InsertOneResult result) {
        final BsonValue insertedId = result.getInsertedId();
        if (insertedId == null) {
            // this should only happen when inserting RawBsonDocuments
            throw new IllegalArgumentException("Inserted ID is null. Make sure that you are inserting documents of " +
                    "type <? extends MongoEntity>.");
        }
        return insertedId.asObjectId().getValue();
    }
@Test
    void testInsertedId() {
        final var id = "6627add0ee216425dd6df37c";
        final var a = new DTO(id, "a");

        assertThat(insertedId(collection.insertOne(a))).isEqualTo(new ObjectId(id));
        assertThat(insertedId(collection.insertOne(new DTO(null, "b")))).isGreaterThan(new ObjectId(id));
    }