summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_internal.h
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2017-08-28 15:10:42 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2017-09-01 15:36:35 -0400
commitbc3e230523e4677e2f3fed64ea89c369182a9272 (patch)
treebb35904e784f224e6d5ab87b508c69c72f447dd3 /src/mongo/db/pipeline/document_internal.h
parent4e01e3582541fc00ec2e83c97cac89b59fbfeb34 (diff)
downloadmongo-bc3e230523e4677e2f3fed64ea89c369182a9272.tar.gz
SERVER-30704 Use ARM to merge agg cursors on mongos.
Diffstat (limited to 'src/mongo/db/pipeline/document_internal.h')
-rw-r--r--src/mongo/db/pipeline/document_internal.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h
index 2fd3c78cf34..baa68e60658 100644
--- a/src/mongo/db/pipeline/document_internal.h
+++ b/src/mongo/db/pipeline/document_internal.h
@@ -196,6 +196,7 @@ public:
enum MetaType : char {
TEXT_SCORE,
RAND_VAL,
+ SORT_KEY,
NUM_FIELDS
};
@@ -280,6 +281,9 @@ public:
if (source.hasRandMetaField()) {
setRandMetaField(source.getRandMetaField());
}
+ if (source.hasSortKeyMetaField()) {
+ setSortKeyMetaField(source.getSortKeyMetaField());
+ }
}
bool hasTextScore() const {
@@ -304,6 +308,17 @@ public:
_randVal = val;
}
+ bool hasSortKeyMetaField() const {
+ return _metaFields.test(MetaType::SORT_KEY);
+ }
+ BSONObj getSortKeyMetaField() const {
+ return _sortKey;
+ }
+ void setSortKeyMetaField(BSONObj sortKey) {
+ _metaFields.set(MetaType::SORT_KEY);
+ _sortKey = sortKey.getOwned();
+ }
+
private:
/// Same as lastElement->next() or firstElement() if empty.
const ValueElement* end() const {
@@ -385,6 +400,7 @@ private:
std::bitset<MetaType::NUM_FIELDS> _metaFields;
double _textScore;
double _randVal;
+ BSONObj _sortKey;
// When adding a field, make sure to update clone() method
// Defined in document.cpp