Package org.mongodb.morphia

Examples of org.mongodb.morphia.Datastore.save()


        final IndexedEntity c = new IndexedEntity("c");

        Datastore ds = getDs();

        ds.save(a);
        ds.save(b);
        ds.save(c);

        Assert.assertEquals("last", b.id, ds.createQuery(IndexedEntity.class).order("id")
                                            .lowerIndexBound(new BasicDBObject("testField", "b")).get().id);
    }
View Full Code Here


        Datastore ds = getDs();

        ds.save(a);
        ds.save(b);
        ds.save(c);

        Assert.assertEquals("last", b.id, ds.createQuery(IndexedEntity.class).order("id")
                                            .lowerIndexBound(new BasicDBObject("testField", "b")).get().id);
    }
View Full Code Here

        final IndexedEntity c1 = new IndexedEntity("c");
        final IndexedEntity c2 = new IndexedEntity("c");

        Datastore ds = getDs();

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);
View Full Code Here

        final IndexedEntity c2 = new IndexedEntity("c");

        Datastore ds = getDs();

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);
View Full Code Here

        Datastore ds = getDs();

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);

        Query<IndexedEntity> min = ds.createQuery(IndexedEntity.class).order("testField, id")
View Full Code Here

        Datastore ds = getDs();

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);

        Query<IndexedEntity> min = ds.createQuery(IndexedEntity.class).order("testField, id")
                                     .lowerIndexBound(new BasicDBObject("testField", "b").append("_id", b1.id));
View Full Code Here

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);

        Query<IndexedEntity> min = ds.createQuery(IndexedEntity.class).order("testField, id")
                                     .lowerIndexBound(new BasicDBObject("testField", "b").append("_id", b1.id));
        List<IndexedEntity> l = min.asList();
View Full Code Here

        ds.save(a1);
        ds.save(a2);
        ds.save(b1);
        ds.save(b2);
        ds.save(c1);
        ds.save(c2);

        Query<IndexedEntity> min = ds.createQuery(IndexedEntity.class).order("testField, id")
                                     .lowerIndexBound(new BasicDBObject("testField", "b").append("_id", b1.id));
        List<IndexedEntity> l = min.asList();
View Full Code Here

        getMorphia().map(IndexOnValue.class, NoIndexes.class);
        Datastore ds = getDs();

        // when
        ds.ensureIndexes();
        ds.save(new IndexOnValue());
        ds.save(new NoIndexes());

        // then
        List<DBObject> indexes = getDb().getCollection("NoIndexes").getIndexInfo();
        assertEquals(1, indexes.size());
View Full Code Here

        Datastore ds = getDs();

        // when
        ds.ensureIndexes();
        ds.save(new IndexOnValue());
        ds.save(new NoIndexes());

        // then
        List<DBObject> indexes = getDb().getCollection("NoIndexes").getIndexInfo();
        assertEquals(1, indexes.size());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.