MongoDb query issue

Does metabase support Aggregation operation like $lte,$eq . since I am not able to apply aggregation operation
its giving an error :
Output of parse-tokens* does not match schema: e[0;33m [(named [nil nil nil nil nil nil nil nil (not (matches-some-precondition? a-clojure.lang.ChunkedCons))] "parsed tokens") (not (present? "remaining tokens"))]

Hi @Shubham_kumar03
Post "Diagnostic Info" from Admin > Troubleshooting, and your MongoDB version.
And post your query.

{
"browser-info": {
"language": "en-IN",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15",
"vendor": "Apple Computer, Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.14+9",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.14",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.14+9",
"os.name": "Linux",
"os.version": "4.19.0-21-cloud-amd64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"h2",
"mysql",
"mongo",
"bigquery-cloud-sdk"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2022-02-08",
"tag": "v0.42.0",
"branch": "release-x.42.x",
"hash": "de1264e"
},
"settings": {
"report-timezone": "Asia/Calcutta"
}
}
}

MongoDb version - 4.2.21

When using mongo native query and using $lte , $eq functions its giving a error if I directly use match it works but not work with $lte , $eq

@Shubham_kumar03

  1. Latest release is 0.44.1: Release Metabase v0.44.1 · metabase/metabase · GitHub
  2. You should migrate away from H2 if you're running Metabase in production: Migrating from the default H2 database to a production database
  3. Post your Mongo query.

[[{$record.shipmentCreatedAt:{$eq:{"$toDate":{"$dateToString":{{date}} ,"format":"%Y-%m-%d"}}}}]]

in this way I am taking the date dynamically and using the $eq or $lte function

We can not query in mongo until we don't migrate from h2 ?

[[{$record.shipmentCreatedAt:{$eq:{"$toDate":{"$dateToString":{{date}} ,"format":"%Y-%m-%d"}}}}]]

in this way I am taking the date dynamically and using the $eq or $lte function

@Shubham_kumar03

Which variable type is {{date}}?

If you are running Metabase in production, then you should not use H2 as the application database. It is prone to corruption. It has nothing to do with which queries you can run.

variable type is date

@flamber variable type is date

@Shubham_kumar03
Try building your questions via the GUI and then converting them to native query.
Or use hardcoded values instead of variable to see if the problem is with your syntax.

Yes I tried to hard code and then see wether I am doing some mistake but the same error persist

And I also wanted to know that if we can apply some condition to limit data on the basis of date so we can get last 7 days data only in mongo native query

@Shubham_kumar03
Run the query directly on Mongo (again without an variables or clauses), if it also fails there, then you know the problem is with your syntax and you can try getting help in a Mongo specific forum.
Create a View on Mongo to limit or model your data, so it never returns more than what you want.