Package org.mongodb.morphia

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


    @After
    public void clearFongo() {
        Datastore ds = new DynamicProjectRepository().getDatastore();

        ds.delete(ds.createQuery(DbBackedProject.class));
        ds.delete(ds.createQuery(DbBackedBuild.class));
        ds.getDB().getCollection(GithubAccessTokenRepository.COLLECTION_NAME).remove(new BasicDBObject());
    }

    @Test
View Full Code Here


    @After
    public void clearFongo() {
        Datastore ds = new DynamicProjectRepository().getDatastore();

        ds.delete(ds.createQuery(DbBackedProject.class));
        ds.delete(ds.createQuery(DbBackedBuild.class));
        ds.getDB().getCollection(GithubAccessTokenRepository.COLLECTION_NAME).remove(new BasicDBObject());
    }

    @Test
    @LocalData
View Full Code Here

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

        Assert.assertEquals("last", b.id, ds.createQuery(IndexedEntity.class).order("-id")
                                            .upperIndexBound(new BasicDBObject("testField", "c")).get().id);
    }

    @Test
    public void testMaxCompoundIndex() {
View Full Code Here

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

        List<IndexedEntity> l = ds.createQuery(IndexedEntity.class).order("testField, id")
                                  .upperIndexBound(new BasicDBObject("testField",
                                                                     "b").append("_id", b2.id)).asList();

        Assert.assertEquals("size", 3, l.size());
        Assert.assertEquals("item", b1.id, l.get(2).id);
View Full Code Here

        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);
    }

    @Test
    public void testMinCompoundIndex() {
View Full Code Here

        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();

        Assert.assertEquals("size", 4, l.size());
        Assert.assertEquals("item", b1.id, l.get(0).id);
View Full Code Here

TOP
Copyright © 2015 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.