Package com.mongodb

Examples of com.mongodb.BasicDBObject.containsField()


        // Build timerange.
        BasicDBObject timerangeConfig = (BasicDBObject) config.get("timerange");
        TimeRange timeRange;

        if (!timerangeConfig.containsField("type")) {
            throw new InvalidRangeParametersException("range type not set");
        }

        String rangeType = (String) timerangeConfig.get("type");
View Full Code Here


        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");
        BasicDBObject key2 = (BasicDBObject) indexInfos.get(2).get("key");

        assertTrue("No index on the field a", key1.containsField("a") && "1".equals(key1.getString("a")));
        assertTrue("No index on the field b", key2.containsField("b") && "-1".equals(key2.getString("b")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledDBAndCollection");
        assertNotNull("No record with 'testInsertDynamicityEnabledDBAndCollection' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
View Full Code Here

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");
        BasicDBObject key2 = (BasicDBObject) indexInfos.get(2).get("key");

        assertTrue("No index on the field a", key1.containsField("a") && "1".equals(key1.getString("a")));
        assertTrue("No index on the field b", key2.containsField("b") && "-1".equals(key2.getString("b")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledCollectionAndIndex");
        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionAndIndex' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
View Full Code Here

        List<DBObject> indexInfos = dynamicCollection.getIndexInfo();

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");

        assertFalse("No index on the field a", key1.containsField("a") && "-1".equals(key1.getString("a")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledCollectionOnlyAndURIIndex");
        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledCollectionOnlyAndURIIndex");
View Full Code Here

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");
        BasicDBObject key2 = (BasicDBObject) indexInfos.get(2).get("key");

        assertTrue("No index on the field b", key1.containsField("b") && "-1".equals(key1.getString("b")));
        assertTrue("No index on the field a", key2.containsField("a") && "1".equals(key2.getString("a")));

        DBObject b = collection.findOne("testInsertAutoCreateCollectionAndURIIndex");
        assertNotNull("No record with 'testInsertAutoCreateCollectionAndURIIndex' _id", b);

        b = testCollection.findOne("testInsertAutoCreateCollectionAndURIIndex");
View Full Code Here

    int i = 0;
    BasicDBObject intermediate = (BasicDBObject) myBson;

    // Set intermediate parents
    while (i < (fields.length - 1)) {
      if (!intermediate.containsField(fields[i]))
        if (createIfMissing)
          intermediate.put(fields[i], new BasicDBObject());
        else
          throw new IllegalAccessError("The field '" + fieldName
              + "' does not exist: '" + fields[i] + "' is missing.");
View Full Code Here

        toSet.put(LockDef.INACTIVE_LOCK_TIMEOUT.field, pLockOptions.getInactiveLockTimeout());

        final BasicDBObject lockDoc
        = (BasicDBObject)getDbCollection(pMongo, pSvcOptions).findAndModify(query, new BasicDBObject(LockDef.ID.field, 1), null, false, new BasicDBObject(SET, toSet), false, false);

        if (lockDoc != null && lockDoc.containsField(LockDef.ID.field)) {

            if (pSvcOptions.getEnableHistory())
            { LockHistoryDao.insert( pMongo, pLockName, pSvcOptions, pLockOptions, serverTime, LockState.LOCKED, lockId, false); }

            return lockId;
View Full Code Here

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");
        BasicDBObject key2 = (BasicDBObject) indexInfos.get(2).get("key");

        assertTrue("No index on the field a", key1.containsField("a") && "1".equals(key1.getString("a")));
        assertTrue("No index on the field b", key2.containsField("b") && "-1".equals(key2.getString("b")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledDBAndCollection");
        assertNotNull("No record with 'testInsertDynamicityEnabledDBAndCollection' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
View Full Code Here

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");
        BasicDBObject key2 = (BasicDBObject) indexInfos.get(2).get("key");

        assertTrue("No index on the field a", key1.containsField("a") && "1".equals(key1.getString("a")));
        assertTrue("No index on the field b", key2.containsField("b") && "-1".equals(key2.getString("b")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledCollectionAndIndex");
        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionAndIndex' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
View Full Code Here

        List<DBObject> indexInfos = dynamicCollection.getIndexInfo();

        BasicDBObject key1 = (BasicDBObject) indexInfos.get(1).get("key");

        assertFalse("No index on the field a", key1.containsField("a") && "-1".equals(key1.getString("a")));

        DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledCollectionOnlyAndURIIndex");
        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id", b);

        b = testCollection.findOne("testInsertDynamicityEnabledCollectionOnlyAndURIIndex");
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.