Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!