[Solved] Can't display Pin Map: error no method 'mbql->native': mongo

Hi everyone,

I am a fresh new user of Metabase. I am working with the latest docker version of it (v0.37.8) and managed successfuly to connect it to my MongoDB database.

I tried to create a Pin Map of my hospital collection, where each entry has a latitude and longitude (and typed as such in the datamodel in the Metabase administration menu).

When trying to render, I got this error:

No method in multimethod 'mbql->native' for dispatch value: :mongo

image

Each entry in my collection looks like this (put in comment the translation) :

{
  "_id": {
    "$oid": "6022f424d5faea1f98af0b85"
  },
  "nom": "egParent", // name
  "type": "Entité Géographique",
  "references": "1220001259",
  "valeurs": "CENTRE HOSPITALIER TREGUIER", // value
  "id": "R5310828",
  "voie": "TOUR SAINT MICHEL", // street
  "complementAdresse": "BP 81", // additional informations
  "commune": "TRÉGUIER", // city
  "codePostal": "22220", // zip code
  "codeInsee": "22362", // national classification zip code
  "departement": "22", // departement number
  "telephone": "01111111111",
  "latitude": "48.787326",
  "longitude": "-3.199135"
}

I don’t understand the error and what I’ve been doing wrong. My collection has 106 entries, so no big deal in terms of data number I think.

Can you help me, please ?

Thank you in advance and I am looking forward reading from you all.

Hi @Clotaire

Please post “Diagnostic Info” from Admin > Troubleshooting.

I doubt that this has anything to do with pin map - can you view the table with raw results?

I have only seen that error, when the driver for some reason doesn’t seem to have been loaded correctly, and a restart of Metabase should fix it:
https://github.com/metabase/metabase/issues/13114

Hi @flamber,

Thank you for your answer!

I can view the table with raw data.

I already restarted Metabase without any enhancement.

Here are the Troubleshooting informations:

{
  "browser-info": {
    "language": "fr",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0",
    "vendor": ""
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.10+9",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.10",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.10+9",
    "os.name": "Linux",
    "os.version": "4.19.128-microsoft-standard",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "mongo"
    ],
    "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-01-26",
      "tag": "v0.37.8",
      "branch": "release-x.37.x",
      "hash": "490cea7"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Thanks again for your help.

@Clotaire

So you can use any other visualization to show your data, but not Pin Map?

I have a feeling that it’s because your latitude/longitude are strings instead of numbers.

Unrelated, but if you’re using Metabase in production, then you should migrate away from H2:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

1 Like

@flamber,

It seems I can’t display a bar chart with the number of entries filtered departement for example.

Maybe your feeling is right. When I go check the docker logs of Metabase, I found this when I try my map visualization:

Summary
2021-02-10 11:20:04,421 INFO driver.impl :: Initialisation du pilote :mongo
2021-02-10 11:20:04,423 INFO plugins.classloader :: Added URL file:/plugins/mongo.metabase-driver.jar to classpath
2021-02-10 11:20:04,424 DEBUG plugins.init-steps :: Chargement du namespace du plugin metabase.driver.mongo...
2021-02-10 11:20:04,424 DEBUG middleware.log :: GET /api/database 200 14.1 ms (4 appels de DB) Connexions App DB : 0/4 Threads Jetty : 7/50 (0 inactif, 0 en file dattente) (43 total de threads actifs) Requêtes en cours : 0 (0 en file dattente)
2021-02-10 11:20:04,467 DEBUG middleware.log :: GET /api/table/8/query_metadata 200 54.5 ms (9 appels de DB) Connexions App DB : 0/4 Threads Jetty : 6/50 (0 inactif, 0 en file dattente) (43 total de threads actifs) Requêtes en cours : 0 (0 en file dattente)
2021-02-10 11:20:05,331 ERROR middleware.catch-exceptions :: Erreur lors du traitement de la requête : null
{:database_id 2,
 :started_at #t "2021-02-10T11:20:04.647916Z[GMT]",
 :json_query {:database 2, :query {:source-table 8}, :type "query", :parameters [], :middleware {:**js-int-to-string? true, :add-default-userland-constraints? true}},**
 :native nil,
 :status :failed,
 :class java.lang.IllegalArgumentException,
 :stacktrace
 ["clojure.lang.MultiFn.getFn(MultiFn.java:156)"
  "clojure.lang.MultiFn.invoke(MultiFn.java:233)"
  "--> query_processor.middleware.mbql_to_native$query__GT_native_form.invokeStatic(mbql_to_native.clj:15)"
  "query_processor.middleware.mbql_to_native$query__GT_native_form.invoke(mbql_to_native.clj:10)"
  "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__44130.invoke(mbql_to_native.clj:23)"
  "query_processor.middleware.check_features$check_features$fn__43406.invoke(check_features.clj:42)"
  "query_processor.middleware.limit$limit$fn__44116.invoke(limit.clj:38)"
  "query_processor.middleware.cache$maybe_return_cached_results$fn__43057.invoke(cache.clj:214)"
  "query_processor.middleware.optimize_datetime_filters$optimize_datetime_filters$fn__44295.invoke(optimize_datetime_filters.clj:133)"
  "query_processor.middleware.auto_parse_filter_values$auto_parse_filter_values$fn__42204.invoke(auto_parse_filter_values.clj:44)"
  "query_processor.middleware.wrap_value_literals$wrap_value_literals$fn__45861.invoke(wrap_value_literals.clj:149)"
  "query_processor.middleware.annotate$add_column_info$fn__41959.invoke(annotate.clj:575)"
  "query_processor.middleware.permissions$check_query_permissions$fn__43281.invoke(permissions.clj:71)"
  "query_processor.middleware.pre_alias_aggregations$pre_alias_aggregations$fn__44813.invoke(pre_alias_aggregations.clj:40)"
  "query_processor.middleware.cumulative_aggregations$handle_cumulative_aggregations$fn__43479.invoke(cumulative_aggregations.clj:61)"
  "query_processor.middleware.resolve_joined_fields$resolve_joined_fields$fn__45050.invoke(resolve_joined_fields.clj:36)"
  "query_processor.middleware.resolve_joins$resolve_joins$fn__45369.invoke(resolve_joins.clj:183)"
  "query_processor.middleware.add_implicit_joins$add_implicit_joins$fn__37684.invoke(add_implicit_joins.clj:254)"
  "query_processor.middleware.large_int_id$convert_id_to_string$fn__44091.invoke(large_int_id.clj:44)"
  "query_processor.middleware.format_rows$format_rows$fn__44071.invoke(format_rows.clj:75)"
  "query_processor.middleware.desugar$desugar$fn__43545.invoke(desugar.clj:22)"
  "query_processor.middleware.binning$update_binning_strategy$fn__42563.invoke(binning.clj:229)"
  "query_processor.middleware.resolve_fields$resolve_fields$fn__43081.invoke(resolve_fields.clj:24)"
  "query_processor.middleware.add_dimension_projections$add_remapping$fn__37228.invoke(add_dimension_projections.clj:318)"
  "query_processor.middleware.add_implicit_clauses$add_implicit_clauses$fn__37435.invoke(add_implicit_clauses.clj:141)"
  "query_processor.middleware.add_source_metadata$add_source_metadata_for_source_queries$fn__37833.invoke(add_source_metadata.clj:105)"
  "query_processor.middleware.reconcile_breakout_and_order_by_bucketing$reconcile_breakout_and_order_by_bucketing$fn__45010.invoke(reconcile_breakout_and_order_by_bucketing.clj:98)"
  "query_processor.middleware.auto_bucket_datetimes$auto_bucket_datetimes$fn__42151.invoke(auto_bucket_datetimes.clj:140)"
  "query_processor.middleware.resolve_source_table$resolve_source_tables$fn__43128.invoke(resolve_source_table.clj:46)"
  "query_processor.middleware.parameters$substitute_parameters$fn__44795.invoke(parameters.clj:114)"
  "query_processor.middleware.resolve_referenced$resolve_referenced_card_resources$fn__43180.invoke(resolve_referenced.clj:80)"
  "query_processor.middleware.expand_macros$expand_macros$fn__43801.invoke(expand_macros.clj:158)"
  "query_processor.middleware.add_timezone_info$add_timezone_info$fn__37864.invoke(add_timezone_info.clj:15)"
  "query_processor.middleware.splice_params_in_response$splice_params_in_response$fn__45731.invoke(splice_params_in_response.clj:32)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__45021$fn__45025.invoke(resolve_database_and_driver.clj:33)"
  "driver$do_with_driver.invokeStatic(driver.clj:61)"
  "driver$do_with_driver.invoke(driver.clj:57)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__45021.invoke(resolve_database_and_driver.clj:27)"
  "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__44019.invoke(fetch_source_query.clj:267)"
  "query_processor.middleware.store$initialize_store$fn__45740$fn__45741.invoke(store.clj:11)"
  "query_processor.store$do_with_store.invokeStatic(store.clj:46)"
  "query_processor.store$do_with_store.invoke(store.clj:40)"
  "query_processor.middleware.store$initialize_store$fn__45740.invoke(store.clj:10)"
  "query_processor.middleware.validate$validate_query$fn__45749.invoke(validate.clj:10)"
  "query_processor.middleware.normalize_query$normalize$fn__44143.invoke(normalize_query.clj:22)"
  "query_processor.middleware.add_rows_truncated$add_rows_truncated$fn__37702.invoke(add_rows_truncated.clj:36)"
  "query_processor.middleware.results_metadata$record_and_return_metadata_BANG_$fn__45716.invoke(results_metadata.clj:147)"
  "query_processor.middleware.constraints$add_default_userland_constraints$fn__43422.invoke(constraints.clj:42)"
  "query_processor.middleware.process_userland_query$process_userland_query$fn__44884.invoke(process_userland_query.clj:136)"
  "query_processor.middleware.catch_exceptions$catch_exceptions$fn__43365.invoke(catch_exceptions.clj:174)"
  "query_processor.reducible$async_qp$qp_STAR___36491$thunk__36492.invoke(reducible.clj:103)"
  "query_processor.reducible$async_qp$qp_STAR___36491.invoke(reducible.clj:109)"
  "query_processor.reducible$sync_qp$qp_STAR___36500$fn__36503.invoke(reducible.clj:135)"
  "query_processor.reducible$sync_qp$qp_STAR___36500.invoke(reducible.clj:134)"
  "query_processor$process_userland_query.invokeStatic(query_processor.clj:237)"
  "query_processor$process_userland_query.doInvoke(query_processor.clj:233)"
  "query_processor$fn__45907$process_query_and_save_execution_BANG___45916$fn__45919.invoke(query_processor.clj:249)"
  "query_processor$fn__45907$process_query_and_save_execution_BANG___45916.invoke(query_processor.clj:241)"
  "query_processor$fn__45951$process_query_and_save_with_max_results_constraints_BANG___45960$fn__45963.invoke(query_processor.clj:261)"
  "query_processor$fn__45951$process_query_and_save_with_max_results_constraints_BANG___45960.invoke(query_processor.clj:254)"
  "api.dataset$fn__52618$fn__52621.invoke(dataset.clj:59)"
  "query_processor.streaming$streaming_response_STAR_$fn__52599$fn__52600.invoke(streaming.clj:73)"
  "query_processor.streaming$streaming_response_STAR_$fn__52599.invoke(streaming.clj:72)"
  "async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:66)"
  "async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:64)"
  "async.streaming_response$do_f_async$fn__24642.invoke(streaming_response.clj:85)"],
 :context :ad-hoc,
 :error "No method in multimethod 'mbql->native' for dispatch value: :mongo",
 :row_count 0,
 :running_time 0,
 :preprocessed
 {:database 2,
  :query
  {:source-table 8,
   :fields
   [[:field-id 90]
    [:field-id 88]
    [:field-id 83]
    [:field-id 82]
    [:field-id 86]
    [:field-id 80]
    [:field-id 91]
    [:field-id 78]
    [:field-id 84]
    [:field-id 89]
    [:field-id 79]
    [:field-id 93]
    [:field-id 92]],
   :limit 2000},
  :type :query,
  :middleware {:js-int-to-string? true, :add-default-userland-constraints? true},
  :info
  {:executed-by 1,
   :context :ad-hoc,
   :nested? false,
   :query-hash [94, 107, -94, -120, -87, -45, -105, 117, 110, 100, 32, 23, -90, -95, 107, 58, 13, -93, -27, -93, 64, -114, -36, 69, 86, 66, -128, -58, 99, -26, 28, 23]},
  :constraints {:max-results 10000, :max-results-bare-rows 2000}},
 :data {:rows [], :cols []}}

I will try to change them to Integer. I’ll post the answer in a few minutes.

@flamber,

Thank you a lot for your help. It’s now working correctly :slight_smile:

I still have a few more questions about using Metabase with Mongo, but it’s not related to this particular error.

  • I’m not using any database but Mongo, so where this H2 database you mention comes from?
  • I’m using 4 collections in Mongo but they have relationship between them (and I read earlier that Metabase doesn’t handle foreign key between tables for mongo databases). How can I still manage to aggregate my data?

Thank you for your help earlier, I was stuck at this problem for hours… !

@Clotaire

  1. Metabase stores it’s information in a database, which is by default H2:
    https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html
  2. Correct, there’s a couple of issues open - see the comments for possible workarounds - upvote by clicking :+1: on the first post of each issue:
    https://github.com/metabase/metabase/issues/1687
    https://github.com/metabase/metabase/issues/9095
1 Like

Thanks a lot, @flamber!

I’m going to check out these links.

Have a nice day!