@Test public void findOneFieldsByQuery() { Group group = reactiveMongoHelper.findOneFieldsByQuery(Collections.singletonMap("id", "2a867ab2efc04d5f912b0e9cd25f0c85"), Group.class, "groupName").block(); assertNotNull(group); System.out.println(group); }
@NonNull public <T> Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields) { Document queryObject = new Document(queryMap); Document fieldsObject = new Document(); for (String f : fields) { fieldsObject.put(f, true); } Query query = new BasicQuery(queryObject, fieldsObject); return findOne(query, entityClass); }
ReactiveMongoHelper { @NonNull public <T> Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields) { Document queryObject = new Document(queryMap); Document fieldsObject = new Document(); for (String f : fields) { fieldsObject.put(f, true); } Query query = new BasicQuery(queryObject, fieldsObject); return findOne(query, entityClass); } }
ReactiveMongoHelper { @NonNull public <T> Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields) { Document queryObject = new Document(queryMap); Document fieldsObject = new Document(); for (String f : fields) { fieldsObject.put(f, true); } Query query = new BasicQuery(queryObject, fieldsObject); return findOne(query, entityClass); } @Autowired  ReactiveMongoHelper(ReactiveMongoTemplate reactiveMongoTemplate); }
ReactiveMongoHelper { @NonNull public <T> Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields) { Document queryObject = new Document(queryMap); Document fieldsObject = new Document(); for (String f : fields) { fieldsObject.put(f, true); } Query query = new BasicQuery(queryObject, fieldsObject); return findOne(query, entityClass); } @Autowired  ReactiveMongoHelper(ReactiveMongoTemplate reactiveMongoTemplate); @NonNull Mono<Page<T>> getAllWithCriteriaByPagination(int page, int size, @NonNull Map<String, Object> criteriaMap, @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllWithCriteriaAndDescSortByPagination(int page, int size,
                                                                       @NonNull String properties,
                                                                       @NonNull Map<String, Object> criteriaMap,
                                                                       @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllByPagination(int page, int size, @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllWithDescSortByPagination(int page, int size, @NonNull String properties, @NonNull Class<T> entityClass); @NonNull Page<T> getPage(@NonNull Pageable pageable, @NonNull List<T> content, long total); @NonNull Flux<T> find(@NonNull Query query, @NonNull Class<T> entityClass); @NonNull Mono<T> findOne(@NonNull Query query, @NonNull Class<T> entityClass); @NonNull Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields); @NonNull Flux<T> findFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields); @NonNull Flux<T> findFieldsByQuery(@NonNull final String queryKey, @NonNull final Object queryValue, @NonNull Class<T> entityClass, String... fields); }
ReactiveMongoHelper { @NonNull public <T> Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields) { Document queryObject = new Document(queryMap); Document fieldsObject = new Document(); for (String f : fields) { fieldsObject.put(f, true); } Query query = new BasicQuery(queryObject, fieldsObject); return findOne(query, entityClass); } @Autowired  ReactiveMongoHelper(ReactiveMongoTemplate reactiveMongoTemplate); @NonNull Mono<Page<T>> getAllWithCriteriaByPagination(int page, int size, @NonNull Map<String, Object> criteriaMap, @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllWithCriteriaAndDescSortByPagination(int page, int size,
                                                                       @NonNull String properties,
                                                                       @NonNull Map<String, Object> criteriaMap,
                                                                       @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllByPagination(int page, int size, @NonNull Class<T> entityClass); @NonNull Mono<Page<T>> getAllWithDescSortByPagination(int page, int size, @NonNull String properties, @NonNull Class<T> entityClass); @NonNull Page<T> getPage(@NonNull Pageable pageable, @NonNull List<T> content, long total); @NonNull Flux<T> find(@NonNull Query query, @NonNull Class<T> entityClass); @NonNull Mono<T> findOne(@NonNull Query query, @NonNull Class<T> entityClass); @NonNull Mono<T> findOneFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields); @NonNull Flux<T> findFieldsByQuery(@NonNull final Map<String, Object> queryMap, @NonNull Class<T> entityClass, String... fields); @NonNull Flux<T> findFieldsByQuery(@NonNull final String queryKey, @NonNull final Object queryValue, @NonNull Class<T> entityClass, String... fields);  }