Skip to content
Advertisement

Convert SQL Query to MongoDB syntax

I have a big problem with converting SQL queries to Mongo DB for Python. I have a question if you know better methods for transferring SQL queries to Mongo DB queries?

I have two queries but I still have big problems with the syntax conversion to Mongo DB.
Maybe there is someone here who can help me?

Table

JavaScript

I have tried various converters but the result is poor.
Maybe there is some other method pandas or another faster tool?

Advertisement

Answer

I personally do not know of any good converters, It’s just easier to understand each query and translate it on your own, especially as the queries you posted here are not too complex.


Query 1:

JavaScript

Combining with the “select” options:

JavaScript

Mongo Playground


Query 2:

JavaScript

Mongo Playground


User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement