Package com.mongodb

Examples of com.mongodb.DBObject.keySet()


            DBObject dbObj = fieldValue == null ? null : mapr.toDBObject(fieldValue, involvedObjects);
            if (dbObj != null) {
                if (!shouldSaveClassName(fieldValue, dbObj, mf))
                    dbObj.removeField(Mapper.CLASS_NAME_FIELDNAME);

                if (dbObj.keySet().size() > 0 || mapr.getOptions().storeEmpties) {
                    dbObject.put(name, dbObj);
                }
            }
        }
    }
View Full Code Here


  private void loadItemsMetadata() throws IOException {
    itemsMetadata = new ConcurrentHashMap<>();
    DBObject contents = (DBObject) JSON.parse(loadFileAsString());
    if (contents != null) {
      for (String key : contents.keySet()) {
        try {
          DBObject metadata = (DBObject) contents.get(key);
          Map<String, String> map = new HashMap<>();
          for (String metadataKey : metadata.keySet()) {
            map.put(metadataKey, metadata.get(metadataKey)
View Full Code Here

    if (contents != null) {
      for (String key : contents.keySet()) {
        try {
          DBObject metadata = (DBObject) contents.get(key);
          Map<String, String> map = new HashMap<>();
          for (String metadataKey : metadata.keySet()) {
            map.put(metadataKey, metadata.get(metadataKey)
                .toString());
          }
          itemsMetadata.put(key, map);
        } catch (ClassCastException e) {
View Full Code Here

        final DBCursor cursor = collection.find().limit(1000);

        final SortedMap<String, Set<Class<?>>> columnsAndTypes = new TreeMap<String, Set<Class<?>>>();
        while (cursor.hasNext()) {
            DBObject object = cursor.next();
            Set<String> keysInObject = object.keySet();
            for (String key : keysInObject) {
                Set<Class<?>> types = columnsAndTypes.get(key);
                if (types == null) {
                    types = new HashSet<Class<?>>();
                    columnsAndTypes.put(key, types);
View Full Code Here

    DBObject row = dbCollection.findOne(rowKey);
    if(row == null) {
      return;
    }
    else {
            Set<String> fieldSet = row.keySet();
            if (BigInteger.class.equals(columnNameType)) {
                intColumnSlice(fieldSet, row);
            } else if (BigDecimal.class.equals(columnNameType)) {
                decimalColumnSlice(fieldSet, row);
            } else if (String.class.equals(columnNameType)) {
View Full Code Here

    }

    private Map<String, Object> getNext() {
      DBObject mongoObject = getMongoCursor().next();
     
      Set<String> keys = mongoObject.keySet();
      Map<String, Object> result = new HashMap<String, Object>(keys.size());
     
      for (String key : keys) {
        Object value = mongoObject.get(key);
        result.put(key, value);
View Full Code Here

          }
          else if ("&&".equals(operator))
          {
            dbObject.putAll(buildDBObjectQuery(leftOperand));
            DBObject rightObject = buildDBObjectQuery(binaryOperation.getRightOperand());
            for (String field : rightObject.keySet())
            {
              Object rightValue = rightObject.get(field);
              Object leftValue = dbObject.get(field);
              if (leftValue instanceof DBObject)
              {
View Full Code Here

        ms.writeField(builder, schema.getFields()[0], val);

        DBObject out = builder.get();

        Set<String> outKeySet = out.keySet();

        assertEquals(2, outKeySet.size());
        assertEquals(1, out.get("f1"));
        assertEquals("2", out.get("f2"));
    }
View Full Code Here

        }

        assertNotNull(colsMap);
        // first remove '' around colsMap
        colsMap = colsMap.substring(1, colsMap.length() - 1);
        Set<String> docKeys = doc.keySet();

        for (String s : ((Map<String, String>) JSON.parse(colsMap)).values()) {
            assertTrue(docKeys.contains(s));
        }
    }
View Full Code Here

      return getSingleCriteriaObject();
    } else {
      DBObject criteriaObject = new BasicDBObject();
      for (Criteria c : this.criteriaChain) {
        DBObject dbo = c.getSingleCriteriaObject();
        for (String k : dbo.keySet()) {
          setValue(criteriaObject, k, dbo.get(k));
        }
      }
      return criteriaObject;
    }
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.