code: public final Optional<T> findFirstByQuery(String query, String sort, Object... params) {
          Find find = this.collection.find(query, params);
          if((sort != null) && !sort.isEmpty()) {
              find.sort(sort);
          }
          Iterable<T> as = find.limit(1).as(this.entityClass);
          Iterator<T> iterator = as.iterator();
          if(iterator.hasNext()) {
              return Optional.of(iterator.next());
          }
          return Optional.empty();
      }
docs: queries with the given string, sorts the result and returns the first element. <code>null</code> is returned if no element is found.
  
  @param query  the query string
  @param sort   the sort string
  @param params the parameters to replace # symbols
  @return the first element found or <code>null</code> if none is found