本文整理汇总了C++中Query::getSort方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::getSort方法的具体用法?C++ Query::getSort怎么用?C++ Query::getSort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::getSort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClusteredCursor
ParallelSortClusteredCursor::ParallelSortClusteredCursor( const set<ServerAndQuery>& servers , const string& ns ,
const Query& q ,
int options , const BSONObj& fields )
: ClusteredCursor( ns , q.obj , options , fields ) , _servers( servers ){
_sortKey = q.getSort().copy();
_needToSkip = 0;
_finishCons();
}
示例2:
TEST(QueryTest, Sort) {
Query q;
q.sort(BSON("a" << 1));
ASSERT_TRUE(q.isComplex());
BSONObj sort = q.getSort();
ASSERT_TRUE(sort.hasField("a"));
ASSERT_EQUALS(sort.getIntField("a"), 1);
}
示例3: calculateConfigDiff
int ConfigDiffTracker<ValType, ShardType>::calculateConfigDiff(CatalogManager* catalogManager) {
_assertAttached();
// Get the diff query required
Query diffQuery = configDiffQuery();
try {
std::vector<ChunkType> chunks;
uassertStatusOK(catalogManager->getChunks(
diffQuery.getFilter(), diffQuery.getSort(), boost::none, &chunks));
return calculateConfigDiff(chunks);
} catch (DBException& e) {
// Should only happen on connection errors
e.addContext(str::stream() << "could not calculate config difference for ns " << _ns);
throw;
}
}
示例4:
// LEGACY Constructor
ParallelSortClusteredCursor::ParallelSortClusteredCursor(const set<string>& servers,
const string& ns,
const Query& q,
int options,
const BSONObj& fields)
: _servers(servers) {
_sortKey = q.getSort().copy();
_needToSkip = 0;
_done = false;
_didInit = false;
// Populate legacy fields
_ns = ns;
_query = q.obj.getOwned();
_options = options;
_fields = fields.getOwned();
_batchSize = 0;
_finishCons();
}