org.mongodb.morphia.query.Query.enableValidation()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.mongodb.morphia.query.Query.enableValidation方法的一些代码示例,展示了Query.enableValidation的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.enableValidation方法的具体详情如下:
包路径:org.mongodb.morphia.query.Query
类名称:Query
方法名:enableValidation

Query.enableValidation介绍

[英]Turns on validation (for all calls made after); by default validation is on
[中]

代码示例

代码示例来源:origin: org.actframework/act-morphia

public MorphiaQuery enableValidation() {
  mq.enableValidation();
  return this;
}

代码示例来源:origin: BlackLabs/play-morphia

public <T extends Model> MorphiaQuery enableValidation() {
  q_.enableValidation();
  return this;
}

代码示例来源:origin: org.mongodb.morphia/morphia

@Override
public <T, V> Query<T> get(final Class<T> clazz, final Iterable<V> ids) {
  return find(clazz).disableValidation().filter(Mapper.ID_KEY + " in", ids).enableValidation();
}

代码示例来源:origin: org.mongodb.morphia/morphia

/**
 * Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a
 * fixed number of the remaining.
 *
 * @param collection The collection use when querying
 * @param clazz      the class to use for mapping the results
 * @param property   the document property to query against
 * @param value      the value to check for
 * @param offset     the number of results to skip
 * @param size       the maximum number of results to return
 * @param validate   if true, validate the query
 * @param <T>        the type to query
 * @param <V>        the type to filter value
 * @return the query
 */
public <T, V> Query<T> find(final String collection, final Class<T> clazz, final String property, final V value, final int offset,
              final int size, final boolean validate) {
  final Query<T> query = find(collection, clazz);
  if (!validate) {
    query.disableValidation();
  }
  query.offset(offset);
  query.limit(size);
  return query.filter(property, value).enableValidation();
}

代码示例来源:origin: org.mongodb.morphia/morphia

.disableValidation()
  .filter(Mapper.ID_KEY, idValue)
  .enableValidation()
  .filter(versionKeyName, oldVersion);
final UpdateResults res = update(query, dbObj, new UpdateOptions()

相关文章