Advertisement
idle

Untitled

May 2nd, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.57 KB | None | 0 0
  1. db.BLOOD_PRESSURE.insert({_id:1, foi_geom:[10,10]})
  2. db.BLOOD_PRESSURE.insert({_id:2, foi_geom:[20,20]})
  3. db.BLOOD_PRESSURE.insert({_id:3, foi_geom:[30,30]})
  4. db.BLOOD_PRESSURE.ensureIndex({foi_geom:"2d"})
  5.  
  6. public static void test8() throws UnknownHostException, MongoException {
  7.     Mongo mongo = new Mongo();
  8.     DB db = mongo.getDB("test");
  9.     DBCollection coll = db.getCollection("BLOOD_PRESSURE");
  10.     new QueryBuilder();
  11.     DBCursor cur = coll.find(QueryBuilder.start("foi_geom").withinBox(8.1,9.5,55.1,54.5).get());
  12.     while(cur.hasNext())
  13.         System.out.println(cur.next());
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement