Package com.mongodb

Examples of com.mongodb.CommandResult.containsField()


    BasicDBObject command = new BasicDBObject("geoNear", "geo");
    Double[] coordinates = {lat,lon};
    command.put("near", coordinates);
    command.put("maxDistance", MAXIMUM_DISTANCE_IN_METERS);
    CommandResult commandResult = MongoDbManager.getDB("feature").command(command);
    if ( commandResult.ok() && commandResult.containsField("results") )
    {
      BasicDBList results = (BasicDBList)commandResult.get("results");
      return results;     
    }
   
View Full Code Here


        } else {
            data = authDB.command(cmd);
        }

        if (data != null) {
            if (data.containsField("$err")) {
                throw new SplitFailedException("Error calculating splits: " + data);
            } else if (!data.get("ok").equals(1.0)) {
                ok = false;
            }
        }
View Full Code Here

            }
        }

        if (!ok) {
            CommandResult stats = inputCollection.getStats();
            if (stats.containsField("primary")) {
                DBCursor shards = inputCollection.getDB().getSisterDB("config")
                                                 .getCollection("shards")
                                                 .find(new BasicDBObject("_id", stats.getString("primary")));
                try {
                    if (shards.hasNext()) {
View Full Code Here

   * @param result the {@link MapReduceOutput}
   */
  public MapReduceResult(MapReduceOutput output) {
    this.resultCollection = output.getOutputCollection();
    CommandResult result = output.getCommandResult();
    if (result.containsField("counts")) {
      DBObject counts = (DBObject)result.get("counts");
      this.numObjectsScanned  = new Long(counts.get("input").toString());
      this.numEmits       = new Long(counts.get("emit").toString());
      this.numObjectsOutput   = new Long(counts.get("output").toString());
    }
View Full Code Here

      DBObject counts = (DBObject)result.get("counts");
      this.numObjectsScanned  = new Long(counts.get("input").toString());
      this.numEmits       = new Long(counts.get("emit").toString());
      this.numObjectsOutput   = new Long(counts.get("output").toString());
    }
    if (result.containsField("timeMillis")) {
      this.timeMillis = new Long(result.get("timeMillis").toString());
    }
  }

  /**
 
View Full Code Here

            add( "maxChunkSize", splitSize ).get();

        log.trace( "Issuing Command: " + cmd );
        CommandResult data = coll.getDB().command(cmd);

        if (data.containsField("$err")){
          throw new IllegalArgumentException("Error calculating splits: " + data);
        }else if ((Double) data.get("ok") != 1.0){
          throw new IllegalArgumentException("Unable to calculate input splits: " + ((String) data.get( "errmsg" )));
        }
        BasicDBList splitData = (BasicDBList)data.get("splitKeys");
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.