Fetch MongoDB data between specific Date

I am trying to Fetch MongoDB data between specific Date using CURL in PHP. My code is like below.

 CURLOPT_POSTFIELDS => '{
    "dataSource": "' . $this->dataSource . '",
     "database": "' . $this->database . '",
     "collection": "' . $this->collection . '",
     "filter": { "type": { "$eq": "'.$query.'" } },
     "createdOn": {
         "$gte": "2022-04-11T00:08:54Z",
         "$lt": "2022-04-11T00:08:54Z"
     }
}',

But I am getting message Invalid parameter(s) specified: createdOn.

I am not sure but I suspect that the last closing brace on the filter line should be after the closing brace of the createdOn object.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.