vertx/src/main/java/eu/internetofus/common/vertx/Repository.java
/**
   * Find one document.
   *
   * @param collectionName of the collections that contains the model to find.
   * @param query          of the document to find.
   * @param fields         to return.
   * @param map            function to modify the found document. If it is
   *                       {@code null} no modification is applied.
   *
   * @return the found document.
   */
Find one document.
@param collectionName of the collections that contains the model to find.
@param query          of the document to find.
@param fields         to return.
@param map            function to modify the found document. If it is
null no modification is applied.

@return the found document.
Find one document . @param collectionName of the collections that contains the model to find . @param query of the document to find . @param fields to return . @param map function to modify the found document . If it is null no modification is applied . @return the found document .
protected Future<JsonObject> findOneDocument(@NotNull final String collectionName, final JsonObject query,
      final JsonObject fields, final Function<JsonObject, JsonObject> map) {
    JsonObject fieldWithoutSchema;
    if (fields == null) {
      fieldWithoutSchema = new JsonObject();
    } else {
      fieldWithoutSchema = fields;
    }
    fieldWithoutSchema.put(SCHEMA_VERSION, false);
    return this.pool.findOne(collectionName, query, fieldWithoutSchema).compose(foundObject -> {
      if (foundObject == null) {
        return Future.failedFuture("Does not exist a document that match '" + query + "'.");
      } else {
        return this.applyMap(foundObject, map);
      }
    });
  }
protected Future < JsonObject > findOneDocument ( @ NotNull final String collectionName , final JsonObject query , final JsonObject fields , final Function < JsonObject , JsonObject > map ) { JsonObject fieldWithoutSchema ; if ( fields == null ) { fieldWithoutSchema = new JsonObject ( ) ; } else { fieldWithoutSchema = fields ; } fieldWithoutSchema . put ( SCHEMA_VERSION , false ) ; return this . pool . findOne ( collectionName , query , fieldWithoutSchema ) . compose ( foundObject -> { if ( foundObject == null ) { return Future . failedFuture ( "Does not exist a document that match '" + query + "'." ) ; } else { return this . applyMap ( foundObject , map ) ; } } ) ; }
Find one document.
Find one document .