'MongoDb 5.0 query returing Location517200 error code

Posting this here for anyone else encountering this error while running a query on MongoDb 5.0 and not able to find the root cause.

Sample Error: {"ok":0,"code":5107200,"codeName":"Location5107200","$clusterTime":{"clusterTime":"7083090928751083534","signature":{"hash":"GDi3A/dasddadfssfsdfsdfddfs=","keyId":"2314243432443433"}},"operationTime":"7083090928751083534","name":"MongoError"}



Solution 1:[1]

Root cause: Review if there are any invalid values being passed to the $skip stage in your operation pipeline.

In my case, under certain scenarios we were passing a null value to $skip, causing this not a descriptive error from MongoDB.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergio Espallargas