void _addToQueryObject(DBObject query, String field, DBObject thing, boolean sendEmpty) { if (thing == null) return; if (!sendEmpty && thing.keySet().size() == 0) return; _addToQueryObject(query, field, thing); }
private void _check() throws MongoException { if (_it != null) return; if (_collection != null && _query != null) { _lookForHints(); DBObject foo = _query; if (hasSpecialQueryFields()) { foo = _specialFields == null ? new BasicDBObject() : _specialFields; _addToQueryObject(foo, "query", _query, true); _addToQueryObject(foo, "orderby", _orderBy, false); if (_hint != null) _addToQueryObject(foo, "$hint", _hint); if (_hintDBObj != null) _addToQueryObject(foo, "$hint", _hintDBObj); if (_explain) foo.put("$explain", true); if (_snapshot) foo.put("$snapshot", true); } _it = _collection.__find( foo, _keysWanted, _skip, _batchSize, _limit, _options, _readPref, _decoderFact.create()); } if (_it == null) { _it = (new LinkedList<DBObject>()).iterator(); _fake = true; } }