use of de.fhg.igd.mongomvcc.VCollection in project mongomvcc by igd-geo.
the class MongoDBVCollectionTest method deleteFromIndex.
/**
* Deletes an object from the index
*/
@Test
public void deleteFromIndex() {
Map<String, Object> p = putPerson("Peter", 26);
VCollection persons = _master.getCollection("persons");
assertEquals(1, persons.find().size());
persons.delete((Long) p.get("uid"));
assertEquals(0, persons.find().size());
}
use of de.fhg.igd.mongomvcc.VCollection in project mongomvcc by igd-geo.
the class MongoDBVCollectionTest method lifetimeInsertedLaterOptimization.
/**
* Tests if lifetime optimization takes effect. Objects that have
* been inserted in a later commit should not be loaded but filtered
* out on the database level already.
*/
@Test
@Ignore("Not ready yet. We need to implement full branch history.")
public void lifetimeInsertedLaterOptimization() {
//ignore this test if we're on MongoDB 1.x
assumeNotNull(((MongoDBVDatabase) _db).getBuildInfo());
assumeTrue(((MongoDBVDatabase) _db).getBuildInfo().getMajorVersion() >= 2);
//insert two documents to skip in-index shortcut
putPerson("Max", 6);
putPerson("Pax", 8);
long firstCID = _master.commit();
putPerson("Elvis", 3);
_master.commit();
VBranch oldMaster = _db.checkout(firstCID);
VCollection persons = oldMaster.getCollection("persons");
VCursor cursor = persons.find();
DBCursor dbcursor = extractDBCursor(cursor);
assertEquals(2, cursor.size());
assertTrue(hasAttachedFilter(cursor));
assertEquals(2, dbcursor.size());
}
Aggregations