[SERVER-84158] Time-series collection not working with $where filter Created: 13/Dec/23  Updated: 02/Feb/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Yuhong Zhang Assignee: Catalin Sumanaru
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Operating System: ALL
Steps To Reproduce:

> db.getCollection('system.js').insert({     _id: "isTeenager",     value: function(age) {         return age >= 13 && age <= 19;     }, })
WriteResult({ "nInserted" : 1 })
> db.createCollection("ts", {timeseries: {timeField: "time"}})
{ "ok" : 1 }
> db.ts.insert({time: new Date(), name: 'Alice', age: 20})
WriteResult({ "nInserted" : 1 })
> db.runCommand({find: "ts", filter: {$where: "isTeenager(this.age)"}})
{
        "ok" : 0,
        "errmsg" : "$where is not allowed in this context",
        "code" : 2,
        "codeName" : "BadValue"
}
> db.foo.insert({name: 'Alice', age: 20})
WriteResult({ "nInserted" : 1 })
> db.runCommand({find: "foo", filter: {$where: "isTeenager(this.age)"}})
{
        "cursor" : {
                "firstBatch" : [ ],
                "id" : NumberLong(0),
                "ns" : "test.foo"
        },
        "ok" : 1
} 

Sprint: QE 2024-01-22, QE 2024-02-05, QE 2024-02-19
Participants:

 Description   

Search for todo after finishing the investigation.


Generated at Thu Feb 08 06:54:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.