summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document.h
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2015-07-17 22:42:31 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2015-07-20 16:03:29 -0400
commit610765fdb94eebf612bd0172ec081ccc21110103 (patch)
treed93bf7404b151c3e681eb1eda9e37ba4a3cb6ae7 /src/mongo/db/pipeline/document.h
parent4f1dda92ed5976ab950e2eaaaffd7bd20296a066 (diff)
downloadmongo-610765fdb94eebf612bd0172ec081ccc21110103.tar.gz
SERVER-533 Add aggregation stage to randomly sample documents
Diffstat (limited to 'src/mongo/db/pipeline/document.h')
-rw-r--r--src/mongo/db/pipeline/document.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document.h b/src/mongo/db/pipeline/document.h
index 5010f69b5fa..c6a100c954b 100644
--- a/src/mongo/db/pipeline/document.h
+++ b/src/mongo/db/pipeline/document.h
@@ -201,6 +201,14 @@ public:
return storage().getTextScore();
}
+ static const StringData metaFieldRandVal; // "$randVal"
+ bool hasRandMetaField() const {
+ return storage().hasRandMetaField();
+ }
+ int64_t getRandMetaField() const {
+ return storage().getRandMetaField();
+ }
+
/// members for Sorter
struct SorterDeserializeSettings {}; // unused
void serializeForSorter(BufBuilder& buf) const;
@@ -421,6 +429,10 @@ public:
storage().setTextScore(score);
}
+ void setRandMetaField(int64_t val) {
+ storage().setRandMetaField(val);
+ }
+
/** Convert to a read-only document and release reference.
*
* Call this to indicate that you are done with this Document and will