/** * Maps fields to retrieve to the {@link MongoPersistentEntity}s properties. <br /> * Also converts and potentially adds missing property {@code $meta} representation. * * @param fieldsObject must not be {@literal null}. * @param entity can be {@litearl null}. * @return * @since 1.6 */ public Document getMappedFields(Document fieldsObject, @Nullable MongoPersistentEntity<?> entity) { Assert.notNull(fieldsObject, "FieldsObject must not be null!"); Document mappedFields = fieldsObject.isEmpty() ? new Document() : getMappedObject(fieldsObject, entity); mapMetaAttributes(mappedFields, entity, MetaMapping.FORCE); return mappedFields; }
/** * Maps fields used for sorting to the {@link MongoPersistentEntity}s properties. <br /> * Also converts properties to their {@code $meta} representation if present. * * @param sortObject * @param entity * @return * @since 1.6 */ public Document getMappedSort(Document sortObject, @Nullable MongoPersistentEntity<?> entity) { Assert.notNull(sortObject, "SortObject must not be null!"); if (sortObject.isEmpty()) { return new Document(); } Document mappedSort = getMappedObject(sortObject, entity); mapMetaAttributes(mappedSort, entity, MetaMapping.WHEN_PRESENT); return mappedSort; }
/** * Maps fields to retrieve to the {@link MongoPersistentEntity}s properties. <br /> * Also converts and potentially adds missing property {@code $meta} representation. * * @param fieldsObject must not be {@literal null}. * @param entity can be {@litearl null}. * @return * @since 1.6 */ public Document getMappedFields(Document fieldsObject, @Nullable MongoPersistentEntity<?> entity) { Assert.notNull(fieldsObject, "FieldsObject must not be null!"); Document mappedFields = fieldsObject.isEmpty() ? new Document() : getMappedObject(fieldsObject, entity); mapMetaAttributes(mappedFields, entity, MetaMapping.FORCE); return mappedFields; }
/** * Maps fields used for sorting to the {@link MongoPersistentEntity}s properties. <br /> * Also converts properties to their {@code $meta} representation if present. * * @param sortObject * @param entity * @return * @since 1.6 */ public Document getMappedSort(Document sortObject, @Nullable MongoPersistentEntity<?> entity) { Assert.notNull(sortObject, "SortObject must not be null!"); if (sortObject.isEmpty()) { return new Document(); } Document mappedSort = getMappedObject(sortObject, entity); mapMetaAttributes(mappedSort, entity, MetaMapping.WHEN_PRESENT); return mappedSort; }