@Override public String toString() { return String.format("{ query: %s %s }", getQueryObject(), getOptions().getProjection() == null ? "" : ", projection: " + getFieldsObject()); }
private void project(final String fieldName, final Object value) { DBObject projection = getOptions().getProjection(); if (projection == null) { projection = new BasicDBObject(); getOptions().projection(projection); } projection.put(fieldName, value); }
private void project(final DBObject value) { DBObject projection = getOptions().getProjection(); if (projection == null) { projection = new BasicDBObject(); getOptions().projection(projection); } projection.putAll(value); }
@Override @Deprecated public DBObject getFieldsObject() { DBObject projection = getOptions().getProjection(); if (projection == null || projection.keySet().size() == 0) { return null; } final MappedClass mc = ds.getMapper().getMappedClass(clazz); Entity entityAnnotation = mc.getEntityAnnotation(); final BasicDBObject fieldsFilter = copy(projection); if (includeFields && entityAnnotation != null && !entityAnnotation.noClassnameStored()) { fieldsFilter.put(Mapper.CLASS_NAME_FIELDNAME, 1); } return fieldsFilter; }
private int hash(final FindOptions options) { if (options == null) { return 0; } int result = options.getBatchSize(); result = 31 * result + getLimit(); result = 31 * result + (options.getModifiers() != null ? options.getModifiers().hashCode() : 0); result = 31 * result + (options.getProjection() != null ? options.getProjection().hashCode() : 0); result = 31 * result + (int) (options.getMaxTime(MILLISECONDS) ^ options.getMaxTime(MILLISECONDS) >>> 32); result = 31 * result + (int) (options.getMaxAwaitTime(MILLISECONDS) ^ options.getMaxAwaitTime(MILLISECONDS) >>> 32); result = 31 * result + options.getSkip(); result = 31 * result + (options.getSortDBObject() != null ? options.getSortDBObject().hashCode() : 0); result = 31 * result + (options.getCursorType() != null ? options.getCursorType().hashCode() : 0); result = 31 * result + (options.isNoCursorTimeout() ? 1 : 0); result = 31 * result + (options.isOplogReplay() ? 1 : 0); result = 31 * result + (options.isPartial() ? 1 : 0); result = 31 * result + (options.getReadPreference() != null ? options.getReadPreference().hashCode() : 0); result = 31 * result + (options.getReadConcern() != null ? options.getReadConcern().hashCode() : 0); result = 31 * result + (options.getCollation() != null ? options.getCollation().hashCode() : 0); return result; }