Package com.mongodb

Examples of com.mongodb.DBObject.keySet()


    Query query = query(where("field").is(new CustomizedField()));
    DBObject result = mapper
        .getMappedObject(query.getQueryObject(), context.getPersistentEntity(CustomizedField.class));

    assertThat(result.containsField("foo"), is(true));
    assertThat(result.keySet().size(), is(1));
  }

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


    Query query = query(where("field.field").is(new CustomizedField()));
    DBObject result = mapper
        .getMappedObject(query.getQueryObject(), context.getPersistentEntity(CustomizedField.class));

    assertThat(result.containsField("foo.foo"), is(true));
    assertThat(result.keySet().size(), is(1));
  }

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

    Query query = query(where("bar").is(new CustomizedField()));
    DBObject result = mapper
        .getMappedObject(query.getQueryObject(), context.getPersistentEntity(CustomizedField.class));

    assertThat(result.containsField("bar"), is(true));
    assertThat(result.keySet().size(), is(1));
  }

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

    Query query = query(where("myvalue").is("$334"));

    DBObject result = mapper.getMappedObject(query.getQueryObject(), null);

    assertThat(result.keySet(), hasSize(1));
    assertThat(result.get("myvalue"), is((Object) "$334"));
  }

  /**
   * @see DATAMONGO-752
View Full Code Here

    Query query = query(where("myvalue").is("$center"));

    DBObject result = mapper.getMappedObject(query.getQueryObject(), null);

    assertThat(result.keySet(), hasSize(1));
    assertThat(result.get("myvalue"), is((Object) "$center"));
  }

  /**
   * @DATAMONGO-805
 
View Full Code Here

            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

            boolean first = true;
            buf.append("{ ");
            DBObject dbo = (DBObject) obj;
            String name;

            for (final String s : dbo.keySet()) {
                name = s;

                if (first)
                    first = false;
                else
View Full Code Here

    long timestamp = timestampL != null ? timestampL : 0;
    long parentCID = (Long)o.get(PARENT_CID);
    long rootCID = (Long)o.get(ROOT_CID);
    DBObject objs = (DBObject)o.get(OBJECTS);
    Map<String, IdMap> objects = new HashMap<String, IdMap>();
    for (String k : objs.keySet()) {
      if (!k.equals(MongoDBConstants.ID)) {
        objects.put(k, resolveCollectionObjects((DBObject)objs.get(k)));
      }
    }
    return new Commit(cid, timestamp, parentCID, rootCID, objects);
View Full Code Here

public class EqualsTest {

    @Test
    public void testEqualsToValue() {
        DBObject actual = new Equals(new MongoProperty("property"), "someValue").asMongoObject();
        assertEquals(actual.keySet(), Collections.singleton("property"));
        assertEquals(actual.get("property"), "someValue");
    }

    @Test(expected = IllegalArgumentException.class)
    public void testEqualsBetweenProperties() {
View Full Code Here

        builder.field("chunkSize", file.getChunkSize());
        builder.field("uploadDate", file.getUploadDate());
        builder.startObject("metadata");
        DBObject metadata = file.getMetaData();
        if (metadata != null) {
            for (String key : metadata.keySet()) {
                builder.field(key, metadata.get(key));
            }
        }
        builder.endObject();
        builder.endObject();
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.