taskless/mongo-data-api

Passing `null` for `sort` results in 400 from mongo

Closed this issue · 0 comments

Optional values such as filter, sort, etc cannot accept null as a payload via the data api. Instead, null values should be omitted.

Example response from MongoDB:

MongoDataAPIError: Bad Request
    at Collection.callApi (file:///home/jakobo/code/t2/node_modules/.pnpm/@taskless+mongo-data-api@0.2.1/node_modules/@taskless/mongo-data-api/src/client.ts:458:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Collection.findOne ...