-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.3.1, 6.0.0-rc8
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
v6.0
-
-
QO 2022-06-13, QO 2022-06-27
-
160
When the following $match expression is pushed down before $_internalUnpackBucket, the meta field of the timeseries is not recognized correctly.
{$match: {$or: [{"tag.office": {$exists: true}}, {"time": {$eq: new Date("2019-02-08T06:41:54.182Z")}}]}}
The $exists predicate is expanded into
'$and': [ { 'control.max.tag.office': { '$exists': true } }, { 'control.min.tag.office': { '$exists': true } } ]
which results in discarding valid documents from the result set.
The correct expansion of the predicate over the metaField "tag" is:
{ 'meta.office': { '$exists': true } }
The problem doesn't appear for other predicate, such as $eq, or if the predicate is the only one in $match, i.e the following aggregations produce correct results:
{$match: {$or: [{"tag.office": {$eq: 3}}, {"time": {$eq: new Date("2019-02-08T06:41:54.182Z")}}]}} {$match: {"tag.office": {$exists: true}}}