diff options
author | Yuhong Zhang <danielzhangyh@gmail.com> | 2021-04-26 15:56:45 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-28 16:26:50 +0000 |
commit | 43941b42e08c6e7b8e5928cc4e6f94ace7667d74 (patch) | |
tree | 40bb422cf4b9be95378a9bf780f7beaf08b13289 /jstests/core/timeseries | |
parent | 60f75fe1b5e7911325c4f23a556bc6c107726433 (diff) | |
download | mongo-43941b42e08c6e7b8e5928cc4e6f94ace7667d74.tar.gz |
SERVER-55213 Distinguish between null and missing for metadata in time-series collections
Diffstat (limited to 'jstests/core/timeseries')
-rw-r--r-- | jstests/core/timeseries/timeseries_metadata.js | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/jstests/core/timeseries/timeseries_metadata.js b/jstests/core/timeseries/timeseries_metadata.js index 9443c9e03ed..412477a06c3 100644 --- a/jstests/core/timeseries/timeseries_metadata.js +++ b/jstests/core/timeseries/timeseries_metadata.js @@ -66,12 +66,6 @@ TimeseriesTest.run((insert) => { 'invalid meta in first bucket: ' + tojson(bucketDocs[0])); assert(!bucketDocs[0].data.hasOwnProperty(metaFieldName), 'unexpected metadata in first bucket data: ' + tojson(bucketDocs[0])); - } else { - assert(bucketDocs[0].hasOwnProperty('meta'), - 'missing meta in first bucket: ' + tojson(bucketDocs[0])); - assert.eq(null, - bucketDocs[0].meta, - 'invalid meta for x in first bucket: ' + tojson(bucketDocs[0])); } // Second bucket should contain documents specified in 'bucketB'. @@ -84,12 +78,6 @@ TimeseriesTest.run((insert) => { 'invalid meta in second bucket: ' + tojson(bucketDocs[1])); assert(!bucketDocs[1].data.hasOwnProperty(metaFieldName), 'unexpected metadata in second bucket data: ' + tojson(bucketDocs[1])); - } else { - assert(bucketDocs[1].hasOwnProperty('meta'), - 'missing meta in second bucket: ' + tojson(bucketDocs[1])); - assert.eq(null, - bucketDocs[1].meta, - 'invalid meta for x in second bucket: ' + tojson(bucketDocs[1])); } }; @@ -112,10 +100,16 @@ TimeseriesTest.run((insert) => { ]); runTest( - // Null metadata field in first bucket. Temporarily use null meta instead of missing meta - // to accomodate the new $_internalUnpackBucket behavior which is null meta in a bucket - // is materialized as "null" meta. - // TODO SERVER-55213: Need to test both missing meta case and null meta case. + [ + {_id: 0, time: t[0], meta: null, x: 0}, + {_id: 1, time: t[1], meta: null, x: 10}, + ], + [ + {_id: 2, time: t[2], x: 20}, + {_id: 3, time: t[3], x: 30}, + ]); + + runTest( [ {_id: 0, time: t[0], meta: null, x: 0}, {_id: 1, time: t[1], meta: null, x: 10}, @@ -131,13 +125,9 @@ TimeseriesTest.run((insert) => { {_id: 0, time: t[0], meta: [1, 2, 3], x: 0}, {_id: 1, time: t[1], meta: [1, 2, 3], x: 10}, ], - // Null metadata field in second bucket. Temporarily use null meta instead of missing meta - // to accomodate the new $_internalUnpackBucket behavior which is null meta in a bucket - // is materialized as "null" meta. - // TODO SERVER-55213: Need to test both missing meta case and null meta case. [ - {_id: 2, time: t[2], meta: null, x: 20}, - {_id: 3, time: t[3], meta: null, x: 30}, + {_id: 2, time: t[2], x: 20}, + {_id: 3, time: t[3], x: 30}, ]); runTest( |