Mongodb query to sql query translator