code: static BsonDocument getVersionedFilter(
        @Nonnull final BsonValue documentId,
        @Nullable final BsonValue version
    ) {
      final BsonDocument filter = new BsonDocument("_id", documentId);
      if (version == null) {
        filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument("$exists", BsonBoolean.FALSE));
      } else {
        filter.put(DOCUMENT_VERSION_FIELD, version);
      }
      return filter;
    }
docs: Returns a query filter for the given document _id and version. The version is allowed to be
  null. The query will match only if there is either no version on the document in the database
  in question if we have no reference of the version or if the version matches the database's
  version.
  
  @param documentId the _id of the document.
  @param version the expected version of the document, if any.
  @return a query filter for the given document _id and version for a remote operation.