diff options
author | Kris Satya <kris.satya@mongodb.com> | 2021-06-14 14:48:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-16 18:48:50 +0000 |
commit | 5d5aaabcc133510a24959446ad2aa6ed6ea1f04b (patch) | |
tree | ceb87d6b45242cd326fc9cf84cf441599739fa2b /jstests | |
parent | d423ad12e4d2d2b242c2cf1f8c84d389869b5e13 (diff) | |
download | mongo-5d5aaabcc133510a24959446ad2aa6ed6ea1f04b.tar.gz |
SERVER-56492 Normalize objects within arrays in time-series metadata
(cherry picked from commit 6d66d9116bdee519bd42123a5ae30439c54dc213)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/timeseries/timeseries_metadata.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/jstests/core/timeseries/timeseries_metadata.js b/jstests/core/timeseries/timeseries_metadata.js index 21047da3826..9fe8de0cf0e 100644 --- a/jstests/core/timeseries/timeseries_metadata.js +++ b/jstests/core/timeseries/timeseries_metadata.js @@ -140,5 +140,38 @@ TimeseriesTest.run((insert) => { [ {_id: 3, time: t[3], meta: {a: 1}, x: 30}, ]); + + runTest( + // Metadata field contains an array within an object. + [ + {_id: 0, time: t[0], meta: {a: [{b: 1, c: 0}]}, x: 0}, + {_id: 1, time: t[1], meta: {a: [{c: 0, b: 1}]}, x: 10}, + ], + [ + {_id: 2, time: t[2], meta: {a: [{b: 2, c: 0}]}, x: 20}, + {_id: 3, time: t[3], meta: {a: [{c: 0, b: 2}]}, x: 30}, + ]); + + runTest( + // Metadata field contains a nested array. + [ + {_id: 0, time: t[0], meta: {a: [{b: 1, c: 0}, [{e: 1, f: 0}]]}, x: 0}, + {_id: 1, time: t[1], meta: {a: [{c: 0, b: 1}, [{f: 0, e: 1}]]}, x: 10}, + ], + [ + {_id: 2, time: t[2], meta: {a: [[{e: 1, f: 0}], {b: 1, c: 0}]}, x: 20}, + {_id: 3, time: t[3], meta: {a: [[{f: 0, e: 1}], {c: 0, b: 1}]}, x: 30}, + ]); + + runTest( + // Metadata field contains an array. + [ + {_id: 0, time: t[0], meta: {a: [1, 2, 3]}, x: 0}, + {_id: 1, time: t[1], meta: {a: [1, 2, 3]}, x: 10}, + ], + [ + {_id: 2, time: t[2], meta: {a: [2, 1, 3]}, x: 20}, + {_id: 3, time: t[3], meta: {a: [2, 1, 3]}, x: 30}, + ]); }); })(); |