use of dev.morphia.test.models.TestEntity in project morphia by mongodb.
the class TestDatastore method testBulkInsert.
@Test
public void testBulkInsert() {
MongoCollection collection = getDs().getCollection(TestEntity.class);
this.getDs().insert(asList(new TestEntity(), new TestEntity(), new TestEntity(), new TestEntity(), new TestEntity()), new InsertManyOptions().writeConcern(WriteConcern.ACKNOWLEDGED));
assertEquals(collection.countDocuments(), 5);
collection.drop();
this.getDs().insert(asList(new TestEntity(), new TestEntity(), new TestEntity(), new TestEntity(), new TestEntity()), new InsertManyOptions().writeConcern(WriteConcern.ACKNOWLEDGED));
assertEquals(collection.countDocuments(), 5);
}
use of dev.morphia.test.models.TestEntity in project morphia by mongodb.
the class TestDatastore method testInsert.
@Test
public void testInsert() {
MongoCollection collection = getDs().getCollection(TestEntity.class);
this.getDs().insert(new TestEntity());
assertEquals(collection.countDocuments(), 1);
this.getDs().insert(new TestEntity(), new InsertOneOptions().writeConcern(WriteConcern.ACKNOWLEDGED));
assertEquals(collection.countDocuments(), 2);
}
Aggregations