diff options
author | Eric Cox <eric.cox@mongodb.com> | 2021-06-04 14:32:48 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-04 15:02:56 +0000 |
commit | 99a8cd98824e8715ea04491ca1d5e6afd34456a9 (patch) | |
tree | 0a83a1ccc982fafc43bf9f19f34d64c6fadab194 /jstests/core/timeseries | |
parent | a8c2848a44540b989d6f52c504f261aadf0c375f (diff) | |
download | mongo-99a8cd98824e8715ea04491ca1d5e6afd34456a9.tar.gz |
Revert "SERVER-56265 Cleanly fail unsupported queries on timeseries collections"
This reverts commit 7e0bc86f525d56dedca7d8bf9c858d5a8b49fae1.
Diffstat (limited to 'jstests/core/timeseries')
-rw-r--r-- | jstests/core/timeseries/timeseries_text_geonear_disallowed.js | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/jstests/core/timeseries/timeseries_text_geonear_disallowed.js b/jstests/core/timeseries/timeseries_text_geonear_disallowed.js deleted file mode 100644 index 8b35b91ea3f..00000000000 --- a/jstests/core/timeseries/timeseries_text_geonear_disallowed.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Test that $geoNear, $near, $nearSphere, and $text are not allowed against timeseries collections - * and such queries fail cleanly. - * - * @tags: [ - * assumes_unsharded_collection, - * does_not_support_transactions, - * requires_fcv_50, - * requires_timeseries, - * ] - */ - -(function() { -"use strict"; - -load("jstests/core/timeseries/libs/timeseries.js"); - -if (!TimeseriesTest.timeseriesCollectionsEnabled(db.getMongo())) { - jsTestLog("Skipping test because the time-series collection feature flag is disabled"); - return; -} - -const timeFieldName = "time"; -const metaFieldName = "tags"; -const testDB = db.getSiblingDB(jsTestName()); -assert.commandWorked(testDB.dropDatabase()); - -const tsColl = testDB.getCollection("ts_point_data"); - -assert.commandWorked(testDB.createCollection( - tsColl.getName(), {timeseries: {timeField: timeFieldName, metaField: metaFieldName}})); - -const nMeasurements = 10; - -for (let i = 0; i < nMeasurements; i++) { - const docToInsert = { - time: ISODate(), - tags: {x: [40, 40], descr: i.toString()}, - value: i + nMeasurements, - }; - assert.commandWorked(tsColl.insert(docToInsert)); -} - -// Test that $geoNear fails cleanly because it cannot be issued against a time-series collection. -assert.commandFailedWithCode( - assert.throws(() => tsColl.find({"meta.x": {$geoNear: [0, 0]}}).itcount()), 5626500); - -// $geoNear aggregation stage -assert.commandFailedWithCode( - assert.throws(() => tsColl.aggregate([{ - $geoNear: { - near: {type: "Point", coordinates: [106.65589, 10.787627]}, - distanceField: "meta.x", - } - }])), - 40602); - -// Test that unimplemented match exprs on time-series collections fail cleanly. -// $near -assert.commandFailedWithCode( - assert.throws(() => tsColl.find({"tags.x": {$near: [0, 0]}}).itcount()), 5626500); - -// $nearSphere -assert.commandFailedWithCode( - assert.throws(() => tsColl - .find({ - "tags.x": { - $nearSphere: { - $geometry: {type: "Point", coordinates: [-73.9667, 40.78]}, - $minDistance: 10, - $maxDistance: 20 - } - } - }) - .itcount()), - 5626500); - -// $text -// Text indices are disallowed on collections clustered by _id. -assert.commandFailedWithCode(tsColl.createIndex({"tags.descr": "text"}), ErrorCodes.InvalidOptions); -// Since a Text index can't be created, a $text query should fail due to a missing index. -assert.commandFailedWithCode(assert.throws(() => tsColl.find({$text: {$search: "1"}}).itcount()), - ErrorCodes.IndexNotFound); -})(); |