Examples of toDBObject()


Examples of com.mongodb.GroupCommand.toDBObject()

        String reduce = getStringFieldValue(Item.grpReduce);
        String finalize = getStringFieldValue(Item.grpFinalize);
        final GroupCommand cmd = new GroupCommand(col, keys, query, initial, reduce, finalize);
//        new DocView(null, "Group", col.getDB(), cmd.toDBObject()).addToTabbedDiv();

        new DbJobCmd(col.getDB(), cmd.toDBObject(), null, button).addJob();
    }
   
    public void distinct(final ButtonBase button) {
        final DBCollection col = getCollectionNode().getCollection();
        final BasicDBObject cmd = new BasicDBObject("distinct", col.getName());
View Full Code Here

Examples of com.mongodb.MapReduceCommand.toDBObject()

        if (getBooleanFieldValue(Item.mrJSMode)) {
            cmd.addExtraOption("jsMode", true);
        }

        final BasicDBObject cmdobj = (BasicDBObject) cmd.toDBObject();
        if (getBooleanFieldValue(Item.mrOutSharded)) {
            ((BasicDBObject) cmdobj.get("out")).put("sharded", true);
        }
        if (getBooleanFieldValue(Item.mrNonAtomic)) {
            ((BasicDBObject) cmdobj.get("out")).put("nonAtomic", true);
View Full Code Here

Examples of org.jongo.bson.BsonDocument.toDBObject()

    @Test
    public void canMarshall() {

        BsonDocument doc = engine.marshall(new Fox("fantastic", "roux"));

        DBObject dbo = doc.toDBObject();
        assertThat(dbo.get("_class")).isEqualTo("org.jongo.model.Fox");
        assertThat(dbo.get("name")).isEqualTo("fantastic");
        assertThat(dbo.get("color")).isEqualTo("roux");
    }
View Full Code Here

Examples of org.jongo.bson.BsonDocument.toDBObject()

        Fox vixen = new Fox("fantastic", "roux");
        vixen.setGender("female");

        BsonDocument doc = custom.marshall(vixen);

        DBObject result = doc.toDBObject();
        assertThat(result.get("gender")).isNull();
        assertThat(result.get("_class")).isEqualTo("org.jongo.model.Fox");
        assertThat(result.get("name")).isEqualTo("fantastic");
        assertThat(result.get("color")).isEqualTo("roux");
    }
View Full Code Here

Examples of org.jongo.bson.BsonDocument.toDBObject()

        Fox vixen = new Fox("fantastic", "roux");
        vixen.setGender("female");

        BsonDocument doc = custom.marshall(vixen);

        DBObject result = doc.toDBObject();
        assertThat(result.get("_class")).isEqualTo("org.jongo.model.Fox");
        assertThat(result.get("name")).isEqualTo("fantastic");
        assertThat(result.get("color")).isEqualTo("roux");
        assertThat(result.get("gender")).isEqualTo("female");
    }
View Full Code Here

Examples of org.jongo.bson.BsonDocument.toDBObject()

        if (parameter instanceof Enum) {
            return marshallPrimitiveWithWrapper(parameter);
        } else {
            BsonDocument document = marshaller.marshall(parameter);
            DBObject dbo = document.toDBObject();

            if (dbo.keySet().isEmpty()) {
                return marshallPrimitiveWithWrapper(parameter);
            } else {
                return dbo;
View Full Code Here

Examples of org.jongo.bson.BsonDocument.toDBObject()

    private Object marshallPrimitiveWithWrapper(Object parameter) {
        final BsonDocument document;

        Map<String, Object> primitiveWrapper = Collections.singletonMap("wrapped", parameter);
        document = marshaller.marshall(primitiveWrapper);
        return document.toDBObject().get("wrapped");
    }
}
View Full Code Here

Examples of org.jongo.query.Query.toDBObject()

        Jongo jongo = new Jongo(getDatabase());

        Query query = jongo.createQuery("{test:1}");

        assertThat(query.toDBObject().get("test")).isEqualTo(1);
    }

    @Test
    public void canGetMapper() throws Exception {
View Full Code Here

Examples of org.jongo.query.Query.toDBObject()

        return with(modifier, new Object[0]);
    }

    public WriteResult with(String modifier, Object... parameters) {
        Query updateQuery = queryFactory.createQuery(modifier, parameters);
        return collection.update(this.query.toDBObject(), updateQuery.toDBObject(), upsert, multi, writeConcern);
    }

    public WriteResult with(Object pojo) {

        DBObject updateDbo = queryFactory.createQuery("{$set:#}", pojo).toDBObject();
View Full Code Here

Examples of org.mongodb.morphia.mapping.Mapper.toDBObject()

        User user = new User();
        user.id = 1;

        user.userObject = "just a String";
        DBObject dbObject = mapper.toDBObject(user);
        Object object = mapper.fromDBObject(User.class, dbObject, new DefaultEntityCache());
        Assert.assertEquals(user.userObject, ((User) object).userObject);
       
        user.userObject = 33;
        dbObject = mapper.toDBObject(user);
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.