Add support for `maxTimeMS` argument in `count`, `insert`, `update`, `delete`
panga opened this issue · comments
FerretDB version
v1.19
Backend
PostgreSQL 13
Environment
OS: Docker for Mac
Deployment: Docker using ghcr.io/ferretdb/ferretdb:1.19.0 image
Deployment details: Docker version 25.0.2
What did you do?
db.survey.insertMany( [
{ "_id": 1, "results": [ { "product": "abc", "score": 10 },
{ "product": "xyz", "score": 5 } ] },
{ "_id": 2, "results": [ { "product": "abc", "score": 8 },
{ "product": "xyz", "score": 7 } ] },
{ "_id": 3, "results": [ { "product": "abc", "score": 7 },
{ "product": "xyz", "score": 8 } ] },
{ "_id": 4, "results": [ { "product": "abc", "score": 7 },
{ "product": "def", "score": 8 } ] }
] );
db.survey.find({}).maxTimeMS(100).count();
What did you expect to see?
Return: 4
In addition to count
, all Mongo commands support maxTimeMS
, or at least that's what Mongo Node.js driver supports (https://github.com/mongodb/node-mongodb-native/blob/v6.3.0/src/operations/command.ts#L41) so the clients are setting it.
It can be ignored in the parser for now to unblock applications using it. See
FerretDB/internal/handler/common/count.go
Lines 24 to 43 in b6fd73b
and other similar places.
What did you see instead?
MongoServerError: count: unknown field "maxTimeMS"
(same for insert, update, delete).
That's strange that the driver sets this field to commands that don't seem to support it. But yeah, we probably should just ignore it, at least for now.
I'd like to try to implement this