Package com.mongodb

Examples of com.mongodb.BasicDBObject.entrySet()


          // Just going to use the first element in the key
          BasicDBObject record = (BasicDBObject) cacheCollection.findOne();
          if (null != record) {
            BasicDBObject key = (BasicDBObject) record.get("key");
            if (1 == key.size()) {
              keyField = "key." + key.entrySet().iterator().next().getKey();
            }
            else {
              throw new RuntimeException("Invalid key size, too complex, eg: " + keyField);         
            }//TOTEST
          }
View Full Code Here


      return enforceTypeNamingPolicy(jaje, nDepth + 1); // keep going until you find primitive/object
    }
    else if (je instanceof BasicDBObject) {
      BasicDBObject jo = (BasicDBObject) je;
      // Nested variables:
      Iterator<Entry<String, Object>> it = jo.entrySet().iterator();
      Map<String, Object> toFixList = null;
      while (it.hasNext()) {
        boolean bFix = false;
        Entry<String, Object> el = it.next();
        String currKey = el.getKey();
View Full Code Here

                   
                long totalChunks = 0;
                long totalSize = stats.getLong("size");
                long totalCount = stats.getLong("count");

                for (Entry shard : shards.entrySet()) {
                    String shardName = (String) shard.getKey();
                    BasicDBObject shardStats = (BasicDBObject) shard.getValue();

                    BasicDBObject query = new BasicDBObject("ns", getCollectionNode().getCollection().getFullName());
                    query.put("shard", shardName);
View Full Code Here

          // Just going to use the first element in the key
          BasicDBObject record = (BasicDBObject) cacheCollection.findOne();
          if (null != record) {
            BasicDBObject key = (BasicDBObject) record.get("key");
            if (1 == key.size()) {
              keyField = "key." + key.entrySet().iterator().next().getKey();
            }
            else {
              throw new RuntimeException("Invalid key size, too complex, eg: " + keyField);         
            }//TOTEST
          }
View Full Code Here

    @Override
    public Map convertObject(MapperContext<BasicDBObject, Map> context) {
        BasicDBObject dbObjectToConvert = context.getObjectToConvert();

        HashMap<String, Object> result = new HashMap<String, Object>();
        for (Map.Entry<String, Object> entry : dbObjectToConvert.entrySet()) {
            String key = entry.getKey();
            Object value = entry.getValue();

            // Workaround as manually inserted numbers into mongo may be treated as "Double"
            if (value instanceof Double && context.getGenericTypes().get(1) == Integer.class) {
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.