本文整理了Java中org.mongodb.morphia.query.Query.getFieldsObject
方法的一些代码示例,展示了Query.getFieldsObject
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getFieldsObject
方法的具体详情如下:
包路径:org.mongodb.morphia.query.Query
类名称:Query
方法名:getFieldsObject
暂无
代码示例来源:origin: org.actframework/act-morphia
@Override
public DBObject getFieldsObject() {
return mq.getFieldsObject();
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> T findAndModify(final Query<T> query, final UpdateOperations<T> operations, final FindAndModifyOptions options) {
DBCollection dbColl = query.getCollection();
// TODO remove this after testing.
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
if (LOG.isTraceEnabled()) {
LOG.info("Executing findAndModify(" + dbColl.getName() + ") with update ");
}
updateForVersioning(query, operations);
DBObject res = dbColl.findAndModify(query.getQueryObject(), options.copy()
.sort(query.getSortObject())
.projection(query.getFieldsObject())
.update(((UpdateOpsImpl<T>) operations).getOps())
.getOptions());
return res == null ? null : mapper.fromDBObject(this, query.getEntityClass(), res, createCache());
}
代码示例来源:origin: org.mongodb.morphia/morphia
@Override
public <T> T findAndDelete(final Query<T> query, final FindAndModifyOptions options) {
DBCollection dbColl = query.getCollection();
if (dbColl == null) {
dbColl = getCollection(query.getEntityClass());
}
if (LOG.isTraceEnabled()) {
LOG.trace("Executing findAndModify(" + dbColl.getName() + ") with delete ...");
}
FindAndModifyOptions copy = enforceWriteConcern(options, query.getEntityClass())
.copy()
.projection(query.getFieldsObject())
.sort(query.getSortObject())
.returnNew(false)
.upsert(false)
.remove(true);
final DBObject result = dbColl.findAndModify(query.getQueryObject(), copy.getOptions());
return result == null ? null : mapper.fromDBObject(this, query.getEntityClass(), result, createCache());
}
代码示例来源:origin: org.mongodb.morphia/morphia
@SuppressWarnings("deprecation")
MapReduceCommand toCommand(final Mapper mapper) {
if (query.getOffset() != 0 || query.getFieldsObject() != null) {
throw new QueryException("mapReduce does not allow the offset/retrievedFields query ");
}
final DBCollection dbColl = inputCollection != null ? getQuery().getCollection().getDB().getCollection(inputCollection)
: query.getCollection();
final String target = outputCollection != null ? outputCollection : mapper.getMappedClass(resultType).getCollectionName();
final MapReduceCommand command = new MapReduceCommand(dbColl, map, reduce, target, outputType, query.getQueryObject());
command.setBypassDocumentValidation(bypassDocumentValidation);
command.setCollation(collation);
command.setFinalize(finalize);
command.setJsMode(jsMode);
command.setLimit(limit);
command.setMaxTime(maxTimeMS, TimeUnit.MILLISECONDS);
command.setOutputDB(outputDB);
command.setReadPreference(readPreference);
command.setScope(scope);
command.setSort(query.getSortObject());
command.setVerbose(verbose);
return command;
}
}
代码示例来源:origin: org.mongodb.morphia/morphia
Assert.parameterNotEmpty("reduce", baseCommand.getReduce());
if (query.getOffset() != 0 || query.getFieldsObject() != null) {
throw new QueryException("mapReduce does not allow the offset/retrievedFields query options.");
内容来源于网络,如有侵权,请联系作者删除!