List of usage examples for com.mongodb BasicDBObject getObjectId
public ObjectId getObjectId(final String field)
From source file:tango.mongo.MongoConnector.java
License:Open Source License
public synchronized void updateField(BasicDBObject field) { ObjectId id = field.getObjectId("_id"); this.field.update(new BasicDBObject("_id", id), field, true, false); }
From source file:tango.mongo.MongoConnector.java
License:Open Source License
private ArrayList<ObjectId> listIds(BasicDBObject query, DBCollection col) { DBCursor cursor = col.find(query);/* w ww . j a v a 2s . c o m*/ ArrayList<ObjectId> res = new ArrayList<ObjectId>(cursor.count()); while (cursor.hasNext()) { BasicDBObject o = (BasicDBObject) cursor.next(); res.add(o.getObjectId("_id")); } return res; }
From source file:tango.mongo.MongoConnector.java
License:Open Source License
public synchronized HashMap<ObjectId, BasicDBObject> getNucleiObjects(ObjectId experimentId) { BasicDBObject query = new BasicDBObject("experiment_id", experimentId).append("channelIdx", 0); DBCursor cursor = object3D.find(query); HashMap<ObjectId, BasicDBObject> res = new HashMap<ObjectId, BasicDBObject>(cursor.size()); while (cursor.hasNext()) { BasicDBObject nuc = (BasicDBObject) cursor.next(); res.put(nuc.getObjectId("nucleus_id"), nuc); }/*from w w w . j av a 2 s .com*/ cursor.close(); return res; }