Mongodb Switch Issue with Conditionals


I spent far to long chasing a wild goose before i eventually just ran the same query directly in mongo shell on my server and it worked.

This leads me to believe that the drivers Datagrip is using for MongoDB has a bug

When adding a math condition such as $eq $lte $gte etc to a branch in a Switch under an aggregate pipeline it complains that it doesnt have two params even though it absolutely does.

Simple Query:

{ $project: {
"mathcheck":{ $switch:
{ branches: [
{ case: { $lte: [ 0, 10 ] }, then: "working" }
default: "default" }

Results in the following Error:

Expression $lte takes exactly 2 arguments. 1 were passed in


MongoDb: 4.0.5

Datagrip: 2019.3.3

Data Grip Mongo Driver: 1.7.2 [latest]


Am I doing something wrong or am i right in that there is an obscure bug?


Comment actions Permalink


Yes it is known issue, and we are working on it.

Comment actions Permalink

Thanks for the quick reply!


Please sign in to leave a comment.