Package com.mongodb

Examples of com.mongodb.DBCollection.save()


    c.save(new BasicDBObject("x", 1));
    c.save(new BasicDBObject("x", 1));
    c.save(new BasicDBObject("x", 2));
    c.save(new BasicDBObject("x", 3));
    c.save(new BasicDBObject("x", 3));
    c.save(new BasicDBObject("x", 3));
  }
}
View Full Code Here


    c.save(new BasicDBObject("x", 1));
    c.save(new BasicDBObject("x", 1));
    c.save(new BasicDBObject("x", 2));
    c.save(new BasicDBObject("x", 3));
    c.save(new BasicDBObject("x", 3));
    c.save(new BasicDBObject("x", 3));
  }
}
View Full Code Here

  @Test
  public void mapReduceShouldUseQueryMapper() {

    DBCollection c = mongoTemplate.getDb().getCollection("jmrWithGeo");

    c.save(new BasicDBObject("x", new String[] { "a", "b" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }).append("loc", new double[] { 0, 0 }));

    Query query = new Query(where("x").ne(new String[] { "a", "b" }).and("loc")
        .within(new Box(new double[] { 0, 0 }, new double[] { 1, 1 })));
View Full Code Here

  public void mapReduceShouldUseQueryMapper() {

    DBCollection c = mongoTemplate.getDb().getCollection("jmrWithGeo");

    c.save(new BasicDBObject("x", new String[] { "a", "b" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }).append("loc", new double[] { 0, 0 }));

    Query query = new Query(where("x").ne(new String[] { "a", "b" }).and("loc")
        .within(new Box(new double[] { 0, 0 }, new double[] { 1, 1 })));
View Full Code Here

    DBCollection c = mongoTemplate.getDb().getCollection("jmrWithGeo");

    c.save(new BasicDBObject("x", new String[] { "a", "b" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }).append("loc", new double[] { 0, 0 }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }).append("loc", new double[] { 0, 0 }));

    Query query = new Query(where("x").ne(new String[] { "a", "b" }).and("loc")
        .within(new Box(new double[] { 0, 0 }, new double[] { 1, 1 })));

    MapReduceResults<ValueObject> results = template.mapReduce(query, "jmrWithGeo", mapFunction, reduceFunction,
View Full Code Here

    assertMapReduceResults(m);
  }

  private void createMapReduceData() {
    DBCollection c = mongoTemplate.getDb().getCollection("jmr1");
    c.save(new BasicDBObject("x", new String[] { "a", "b" }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }));
  }

  private Map<String, Float> copyToMap(MapReduceResults<ValueObject> results) {
View Full Code Here

  }

  private void createMapReduceData() {
    DBCollection c = mongoTemplate.getDb().getCollection("jmr1");
    c.save(new BasicDBObject("x", new String[] { "a", "b" }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }));
  }

  private Map<String, Float> copyToMap(MapReduceResults<ValueObject> results) {
    List<ValueObject> valueObjects = new ArrayList<ValueObject>();
View Full Code Here

  private void createMapReduceData() {
    DBCollection c = mongoTemplate.getDb().getCollection("jmr1");
    c.save(new BasicDBObject("x", new String[] { "a", "b" }));
    c.save(new BasicDBObject("x", new String[] { "b", "c" }));
    c.save(new BasicDBObject("x", new String[] { "c", "d" }));
  }

  private Map<String, Float> copyToMap(MapReduceResults<ValueObject> results) {
    List<ValueObject> valueObjects = new ArrayList<ValueObject>();
    for (ValueObject valueObject : results) {
View Full Code Here

    final List<Person> persons = getPersonObjects(numberOfPersons);

    executeWatched(new WatchCallback<Void>() {
      public Void doInWatch() {
        for (Person person : persons) {
          collection.save(person.toDBObject());
        }
        return null;
      }
    });
View Full Code Here

        level1Object.put("activity", level2);
        level1.add(level1Object);
      }
      dbo.put("users", level1);
     
      coll.save(dbo);
    }
  }
 
  protected void setup(){
    try{
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.