Is it possible to handle _bsontype error when do query to mongodb?

Viewed 38

When i try to do a query to mongodb by aggregation with _bsontype key inside $sort stage, for example: {$sort: {_bsontype: -1}}, i received an error: TypeError: Unrecognized or invalid _bsontype: -1

Current error example in code after performing aggregation

$sort stage with _bsontype value

I receive _bsontype key from a query params url when doing GET request to a specific route and then create specific stages inside some method programmatically.

But when I paste something else instead of _bsontype in query params, for example: _bjontype, just replace 1 letter, everything works properly, the problem is only with _bsontype value.

Does anyone faced with such a problem?

0 Answers
Related