diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2017-06-27 13:29:02 -0400 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2017-08-01 17:16:14 -0400 |
commit | ad30a49a33b8773cbc07388bb257d605cbd6aa12 (patch) | |
tree | 3707869546caa93ed42efd29cc8404c8f36f9e4a /src/mongo/db/pipeline/document_source_bucket_test.cpp | |
parent | 2431e1356823d898ef8af16997d6f63b65b385a5 (diff) | |
download | mongo-ad30a49a33b8773cbc07388bb257d605cbd6aa12.tar.gz |
SERVER-29135 Add post-image lookup to $changeNotification
This patch only adds support on an unsharded collection.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_bucket_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_bucket_test.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/document_source_bucket_test.cpp b/src/mongo/db/pipeline/document_source_bucket_test.cpp index 1a61934dcb5..26f18c4dca9 100644 --- a/src/mongo/db/pipeline/document_source_bucket_test.cpp +++ b/src/mongo/db/pipeline/document_source_bucket_test.cpp @@ -47,21 +47,22 @@ namespace mongo { namespace { -using std::vector; using boost::intrusive_ptr; +using std::list; +using std::vector; class BucketReturnsGroupAndSort : public AggregationContextFixture { public: void testCreateFromBsonResult(BSONObj bucketSpec, Value expectedGroupExplain) { - vector<intrusive_ptr<DocumentSource>> result = + list<intrusive_ptr<DocumentSource>> result = DocumentSourceBucket::createFromBson(bucketSpec.firstElement(), getExpCtx()); ASSERT_EQUALS(result.size(), 2UL); - const auto* groupStage = dynamic_cast<DocumentSourceGroup*>(result[0].get()); + const auto* groupStage = dynamic_cast<DocumentSourceGroup*>(result.front().get()); ASSERT(groupStage); - const auto* sortStage = dynamic_cast<DocumentSourceSort*>(result[1].get()); + const auto* sortStage = dynamic_cast<DocumentSourceSort*>(result.back().get()); ASSERT(sortStage); // Serialize the DocumentSourceGroup and DocumentSourceSort from $bucket so that we can @@ -154,7 +155,7 @@ TEST_F(BucketReturnsGroupAndSort, BucketSucceedsWithMultipleBoundaryValues) { class InvalidBucketSpec : public AggregationContextFixture { public: - vector<intrusive_ptr<DocumentSource>> createBucket(BSONObj bucketSpec) { + list<intrusive_ptr<DocumentSource>> createBucket(BSONObj bucketSpec) { auto sources = DocumentSourceBucket::createFromBson(bucketSpec.firstElement(), getExpCtx()); return sources; } @@ -267,14 +268,14 @@ TEST_F(InvalidBucketSpec, GroupFailsForBucketWithInvalidOutputField) { TEST_F(InvalidBucketSpec, SwitchFailsForBucketWhenNoDefaultSpecified) { const auto spec = fromjson("{$bucket : {groupBy : '$x', boundaries : [1, 2, 3]}}"); - vector<intrusive_ptr<DocumentSource>> bucketStages = createBucket(spec); + list<intrusive_ptr<DocumentSource>> bucketStages = createBucket(spec); ASSERT_EQUALS(bucketStages.size(), 2UL); - auto* groupStage = dynamic_cast<DocumentSourceGroup*>(bucketStages[0].get()); + auto* groupStage = dynamic_cast<DocumentSourceGroup*>(bucketStages.front().get()); ASSERT(groupStage); - const auto* sortStage = dynamic_cast<DocumentSourceSort*>(bucketStages[1].get()); + const auto* sortStage = dynamic_cast<DocumentSourceSort*>(bucketStages.back().get()); ASSERT(sortStage); auto doc = Document{{"x", 4}}; |