code: @SuppressWarnings("unchecked")
    @Override
    public <T> T findOne(String jxQuery, String collectionName) {
      CollectionMetaData collectionMeta = cmdMap.get(collectionName);
      if((null == collectionMeta) || (!collectionsRef.get().containsKey(collectionName))) {
        throw new InvalidJsonDbApiUsageException("Collection by name '" + collectionName + "' not found. Create collection first");
      }
      collectionMeta.getCollectionLock().readLock().lock();
      try {
        JXPathContext context = contextsRef.get().get(collectionName);
        Iterator<T> resultItr = context.iterate(jxQuery);
        while (resultItr.hasNext()) {
          T document = resultItr.next();
          Object obj = Util.deepCopy(document);
          if(encrypted && collectionMeta.hasSecret() && null!= obj){
            CryptoUtil.decryptFields(obj, collectionMeta, dbConfig.getCipher());
          }
          return (T) obj; // Return the first element we find.
        }
        return null;
      } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        logger.error("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
        throw new JsonDBException("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
      } finally {
        collectionMeta.getCollectionLock().readLock().unlock();
      }
    }
docs: /* (non-Javadoc)
  @see io.jsondb.JsonDBOperations#findOne(java.lang.String, java.lang.String)