private DBCursor prepareCursor(final FindOptions findOptions) { final DBObject query = getQueryObject(); if (LOG.isTraceEnabled()) { LOG.trace( String.format( "Running query(%s) : %s, options: %s,", dbColl.getName(), query, findOptions)); } if (findOptions.isSnapshot() && (findOptions.getSortDBObject() != null || findOptions.hasHint())) { LOG.warning("Snapshotted query should not have hint/sort."); } if (findOptions.getCursorType() != NonTailable && (findOptions.getSortDBObject() != null)) { LOG.warning("Sorting on tail is not allowed."); } return dbColl .find( query, findOptions.getOptions().copy().sort(getSortObject()).projection(getFieldsObject())) .setDecoderFactory(ds.getDecoderFact()); }
private boolean compare(final FindOptions these, final FindOptions those) { if (these == null && those != null || these != null && those == null) { return false; } if (these == null) { return true; } DBCollectionFindOptions dbOptions = these.getOptions(); DBCollectionFindOptions that = those.getOptions(); if (dbOptions.getBatchSize() != that.getBatchSize()) { return false; } if (dbOptions.getLimit() != that.getLimit()) { return false; } if (dbOptions.getMaxTime(MILLISECONDS) != that.getMaxTime(MILLISECONDS)) { return false; } if (dbOptions.getMaxAwaitTime(MILLISECONDS) != that.getMaxAwaitTime(MILLISECONDS)) { return false; } if (dbOptions.getSkip() != that.getSkip()) { return false; } if (dbOptions.isNoCursorTimeout() != that.isNoCursorTimeout()) { return false; } if (dbOptions.isOplogReplay() != that.isOplogReplay()) { return false; } if (dbOptions.isPartial() != that.isPartial()) { return false; } if (dbOptions.getModifiers() != null ? !dbOptions.getModifiers().equals(that.getModifiers()) : that.getModifiers() != null) { return false; } if (dbOptions.getProjection() != null ? !dbOptions.getProjection().equals(that.getProjection()) : that.getProjection() != null) { return false; } if (dbOptions.getSort() != null ? !dbOptions.getSort().equals(that.getSort()) : that.getSort() != null) { return false; } if (dbOptions.getCursorType() != that.getCursorType()) { return false; } if (dbOptions.getReadPreference() != null ? !dbOptions.getReadPreference().equals(that.getReadPreference()) : that.getReadPreference() != null) { return false; } if (dbOptions.getReadConcern() != null ? !dbOptions.getReadConcern().equals(that.getReadConcern()) : that.getReadConcern() != null) { return false; } return dbOptions.getCollation() != null ? dbOptions.getCollation().equals(that.getCollation()) : that.getCollation() == null; }