Table Column Order Database Incorrect

We are adding new tables to MongoDB at run-time. These are imported to Metabase on /sync_schema. The table column order in Admin is "Database". However, the column order in Admin > Data Model, and therefore the column order when visualizing table, is not the order in the database.

Is there some way to force the column order to be the order of the properties in MongoDB collection? Or, do we need to use the API after import to change the column order type to "Custom" and re-order the columns to desired order?

Thanks in advance.

Diagnostic Info:

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 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": "4.19.128-microsoft-standard",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"mongo",
"h2"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "13.2 (Debian 13.2-1.pgdg100+1)"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.18"
}
},
"run-mode": "prod",
"version": {
"date": "2021-04-27",
"tag": "v0.39.1",
"branch": "release-x.39.x",
"hash": "6beba48"
},
"settings": {
"report-timezone": null
}
}
}

Hi @metabasedev01
You are likely seeing this issue:
https://github.com/metabase/metabase/issues/13024 - upvote by clicking :+1: on the first post
Change to any of order order types and then change to "Column order: Database".

Unfortunately, the recommended steps don't correct the issue. The database order in the metabase database is incorrect on import. So when setting it the Order type back to Database the order is not correct.

It looks like we will need to update the order to Custom order, and supply the field order, via the API. Any thoughts on this?

@metabasedev01
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.