Package com.mongodb

Examples of com.mongodb.DBObject.containsField()


    Update update = new Update().pull("nested.dbRefAnnotatedList.id", "2");
    DBObject mappedObject = mapper
        .getMappedObject(update.getUpdateObject(), context.getPersistentEntity(Wrapper.class));

    DBObject pullClause = getAsDBObject(mappedObject, "$pull");
    assertThat(pullClause.containsField("mapped.dbRefAnnotatedList"), is(true));
  }

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


    Update update = new Update().set("listOfInterface.$.value", "expected-value");
    DBObject mappedObject = mapper.getMappedObject(update.getUpdateObject(),
        context.getPersistentEntity(ParentClass.class));

    DBObject setClause = getAsDBObject(mappedObject, "$set");
    assertThat(setClause.containsField("listOfInterface.$.value"), is(true));
  }

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

   */
  DBObject applyAndReturnPotentiallyChangedCommand(DBObject command) {

    DBObject result = new BasicDBObject(command.toMap());

    if (allowDiskUse && !result.containsField(ALLOW_DISK_USE)) {
      result.put(ALLOW_DISK_USE, allowDiskUse);
    }

    if (explain && !result.containsField(EXPLAIN)) {
      result.put(EXPLAIN, explain);
View Full Code Here

    if (allowDiskUse && !result.containsField(ALLOW_DISK_USE)) {
      result.put(ALLOW_DISK_USE, allowDiskUse);
    }

    if (explain && !result.containsField(EXPLAIN)) {
      result.put(EXPLAIN, explain);
    }

    if (cursor != null && !result.containsField(CURSOR)) {
      result.put("cursor", cursor);
View Full Code Here

    if (explain && !result.containsField(EXPLAIN)) {
      result.put(EXPLAIN, explain);
    }

    if (cursor != null && !result.containsField(CURSOR)) {
      result.put("cursor", cursor);
    }

    return result;
  }
View Full Code Here

    Person person = new Person();

    DBObject result = new BasicDBObject();
    converter.write(person, result);

    assertThat(result.containsField(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY), is(true));
    assertThat(result.get(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY).toString(), is(Person.class.getName()));
  }

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

    person.firstname = "Oliver";

    DBObject result = new BasicDBObject();
    converter.write(person, result);

    assertThat(result.containsField("foo"), is(true));
    assertThat(result.containsField("firstname"), is(false));
  }

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

    DBObject result = new BasicDBObject();
    converter.write(person, result);

    assertThat(result.containsField("foo"), is(true));
    assertThat(result.containsField("firstname"), is(false));
  }

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

    BasicDBList list = (BasicDBList) result.get("listOfMaps");
    assertThat(list, is(notNullValue()));
    assertThat(list.size(), is(1));

    DBObject dbObject = (DBObject) list.get(0);
    assertThat(dbObject.containsField("Foo"), is(true));
    assertThat((String) dbObject.get("Foo"), is(Locale.ENGLISH.toString()));
  }

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

    Map<String, List<Locale>> map = Collections.singletonMap("Foo", Arrays.asList(Locale.US));
    DBObject result = new BasicDBObject();
    converter.write(map, result);

    assertThat(result.containsField("Foo"), is(true));
    assertThat(result.get("Foo"), is(notNullValue()));
    assertThat(result.get("Foo"), is(instanceOf(BasicDBList.class)));

    BasicDBList list = (BasicDBList) result.get("Foo");
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.