Upgraded to v0.40, is the unix millisecond time not support?


I am using mongodb and all time fields stored in milliseconds.
After I upgraded to 0.40 from 0.37 version, all dashboard with time linking was shown "There was a problem displaying this chart".

So I checked the time format, all time fields only shown "no special type", they were losed the type setting. The dropdown list time type only exists "creation time, creation timestamp", no time type for millisecond.

So I downgraded to old version, the data model panel shown error with SQL error.
Anyone encountered this problem before? how to fix this?

Hi @gege
Metabase does not support downgrading. You need to revert to your backup from before you upgraded.
There's now a Cast option if you click the :gear: of the field in Data Model.
But you are likely seeing this issue:
https://github.com/metabase/metabase/issues/16177 - upvote by clicking :+1: on the first post

Hi, @flamber , Thanks for your information

I checked "Data Model -> Filed Setting", but I cannot found Cast option to force the filed type. And I checked the issue you mentioned, it looks like not same.


  1. Post "Diagnostic Info" from Admin > Troubleshooting
  2. When you see errors on the dashboard, then check the log for more details - Admin > Troubleshooting > Logs.
  3. If the field is an integer used for UNIX timestamp, then there's a Cast section available:

Thanks @flamber , I cannot found cast option, it may be cased by below information.

I found this error in logs:

 "Command failed with error 40515 (Location40515): ''millisecond' must evaluate to an integer, found double with value 1.66124e+12' on server The full response is { \"ok\" : 0.0, \"errmsg\" : \"'millisecond' must evaluate to an integer, found double with value 1.66124e+12\", \"code\" : 40515, \"codeName\" : \"Location40515\" }",
  "browser-info": {
    "language": "zh-CN",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
    "vendor": "Google Inc."
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.11+9",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.11",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.11+9",
    "os.name": "Linux",
    "os.version": "5.3.0-1030-aws",
    "user.language": "en",
    "user.timezone": "Asia/Hong_Kong"
  "metabase-info": {
    "databases": [
    "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": "2021-08-26",
      "tag": "v0.40.3.1",
      "branch": "release-x.40.x",
      "hash": "0550b86"
    "settings": {
      "report-timezone": "Asia/Hong_Kong"

@gege Well, you are using a DOUBLE type in your database, when it should be INTEGER.
And if you are using Metabase in production, then migrate away from H2:

Hi, @flamber

Thanks for your quick response.

I using mongodb currently. And I cannot found how to change INTEGER from DOUBLE, is there any manual configuration to change the type?

@gege In Mongo, you need to define the field like so:
"millisecond" : NumberLong(1661240000000),
And then you need to re-sync with Metabase again - Admin > Databases > (db) > Sync database schema now

I am so sorry, I do not know how to define this. I checked whole admin console, how to fill this in to the right place? @flamber

@gege You need to do this in Mongo, not Metabase. UNIX timestamp does not support decimals. That is why you define it as seconds, milliseconds or microseconds.

@flamber thanks for your reply, I will try to do that.