Package com.mongodb

Examples of com.mongodb.BasicDBObject.keySet()


    if (!(candidate instanceof BasicDBObject)) {
      return false;
    }

    BasicDBObject dbObject = (BasicDBObject) candidate;
    Set<String> keys = dbObject.keySet();

    if (keys.size() != 1) {
      return false;
    }
View Full Code Here


    outputUri = getParam().getValue(ParamKey.outputUri, this.outputUri).trim();
    outputFields = getParam().getValue(ParamKey.outputFields, this.outputFields).trim();
    bulkInsertLine = getParam().getIntValue(ParamKey.bulkInsertLine, this.bulkInsertLine);
   
    BasicDBObject json = (BasicDBObject) JSON.parse(outputFields);
    fieldNames = json.keySet().toArray(new String[json.keySet().size()]);   
  }

  @Override
  public void connection() {
    MongoURI uri = new MongoURI(outputUri);
View Full Code Here

    outputUri = getParam().getValue(ParamKey.outputUri, this.outputUri).trim();
    outputFields = getParam().getValue(ParamKey.outputFields, this.outputFields).trim();
    bulkInsertLine = getParam().getIntValue(ParamKey.bulkInsertLine, this.bulkInsertLine);
   
    BasicDBObject json = (BasicDBObject) JSON.parse(outputFields);
    fieldNames = json.keySet().toArray(new String[json.keySet().size()]);   
  }

  @Override
  public void connection() {
    MongoURI uri = new MongoURI(outputUri);
View Full Code Here

            entity = expectedEntityType.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        for (String key : dbObject.keySet()) {
            Object value = dbObject.get(key);
            Property<Object> property;

            if ("_id".equals(key)) {
                // Current property is "id"
View Full Code Here

        e.setError(o.getString("error"));

        BasicDBObject d = (BasicDBObject) o.get("details");
        if (d != null) {
            Map<String, String> details = new HashMap<String, String>();
            for (Object k : d.keySet()) {
                details.put((String) k, d.getString((String) k));
            }
            e.setDetails(details);
        }
View Full Code Here

        Set<String> indexNames = new HashSet<String>(); // List of all current
        // index names
        for (DBObject index : indexes)
        {
            BasicDBObject obj = (BasicDBObject) index.get("key");
            Set<String> set = obj.keySet(); // Set containing index name which
            // is key
            indexNames.addAll(set);
        }

        // Create index if not already created
View Full Code Here

                }
                parentNode.add(currentNode);
            }
        } else if (mongoObject instanceof BasicDBObject) {
            BasicDBObject basicDBObject = (BasicDBObject) mongoObject;
            for (String key : basicDBObject.keySet()) {
                Object value = basicDBObject.get(key);
                JsonTreeNode currentNode = new JsonTreeNode(MongoKeyValueDescriptor.createDescriptor(key, value));
                if (value instanceof DBObject) {
                    processDbObject(currentNode, (DBObject) value);
                }
View Full Code Here

        }

        @Override
        public StringEntryIterator readStringMap(String key) throws Exception {
            final BasicDBObject childObj = (BasicDBObject) obj.get(encodeName(key));
            final Iterator<String> it = childObj.keySet().iterator();
            return new StringEntryIterator() {
                @Override
                public boolean hasNext() {
                    return it.hasNext();
                }
View Full Code Here

        }

        @Override
        public BytesEntryIterator readBytesMap(String key) throws Exception {
            final BasicDBObject childObj = (BasicDBObject) obj.get(encodeName(key));
            final Iterator<String> it = childObj.keySet().iterator();
            return new BytesEntryIterator() {
                @Override
                public boolean hasNext() {
                    return it.hasNext();
                }
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.