private boolean _handleSpecialObjects(String name, DBObject o) { if (o == null) return false; if (o instanceof DBCollection) { DBCollection c = (DBCollection) o; putDBPointer(name, c.getName(), Bytes.COLLECTION_REF_ID); return true; } if (!_dontRefContains(o) && name != null && o instanceof DBPointer) { DBPointer r = (DBPointer) o; putDBPointer(name, r._ns, (ObjectId) r._id); return true; } if (!(o instanceof List) && o.get(Bytes.NO_REF_HACK) != null) { o.removeField(Bytes.NO_REF_HACK); return false; } if (!_dontRefContains(o) && name != null && !(o instanceof List) && cameFromDB(o)) { putDBPointer(name, o.get("_ns").toString(), (ObjectId) (o.get("_id"))); return true; } return false; }
DBObject isMasterCmd() { DBCollection collection = _mongo.getDB("admin").getCollection("$cmd"); Iterator<DBObject> i = collection.__find(_isMaster, null, 0, 1, 0); if (i == null || !i.hasNext()) throw new MongoException("no result for ismaster query?"); DBObject res = i.next(); if (i.hasNext()) throw new MongoException("what's going on"); return res; }