New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miss column in query builder result for MongoDB #4946

Open
Densol92 opened this Issue May 3, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@Densol92

Densol92 commented May 3, 2017

Metabase version 0.23.1, Running in Docker
Reproduced in Chrome, Firefox, Windows 8, Fedora 23
Metabase internal database - default

I have mongo for store some reports. It looks like:
{'report_name': 'SOME_REPORT_NAME', 'date': REPORT_DATE, 'some_field': FIELD_VALUE} etc.
I add some fields and everything looks great until today.
I add new report { "_id" : ObjectId(SOME_ID), "date" : ISODate("2017-05-01T21:27:47.255Z"), "report_name" : "new_os_ext_count", "new_os_ext_count" : 451 } and want to make a question in Metabase, and i get this
selection_063
as u see "new_os_ext_count" is missing. If i search directly by id its also missing.
Default query builder is
[{"$project":{"total":"$total","date~~~default":{"$let":{"vars":{"field":"$date"},"in":"$$field"}},"ui_type":"$ui_type","country":"$country","ppa_servers":"$ppa_servers","servers":"$servers","count":"$count","report_name":"$report_name","extension":"$extension","script":"$script","domains":"$domains","installed_component":"$installed_component","ppa_domains":"$ppa_domains","operation_system":"$operation_system","version":"$version","_id":"$_id","report":"$report","instances":"$instances","language":"$language","client":"$client","php_handler":"$php_handler","installation_time_sec":"$installation_time_sec"}},{"$match":{"report_name":{"$eq":"new_os_ext_count"}}},{"$project":{"total":"$total","date~~~default":"$date~~~default","ui_type":"$ui_type","country":"$country","ppa_servers":"$ppa_servers","servers":"$servers","count":"$count","report_name":"$report_name","extension":"$extension","script":"$script","domains":"$domains","installed_component":"$installed_component","ppa_domains":"$ppa_domains","operation_system":"$operation_system","version":"$version","_id":"$_id","report":"$report","instances":"$instances","language":"$language","client":"$client","php_handler":"$php_handler","installation_time_sec":"$installation_time_sec"}},{"$limit":2000}]

If i use custom query it works fine [{"$match":{"report_name":{"$eq":"new_os_ext_count"}}},{"$limit":2000}]
selection_064

How can it be fixed? Not all people know NoSQL

@salsakran

This comment has been minimized.

Show comment
Hide comment
@salsakran

salsakran May 4, 2017

Contributor

We don't show all columns for every row. We expect the documents in a Mongo collection to all effectively have the same schema.

If you have a per-collection specific key, we won't find and display most of those. In general, I'd recommend naming all the columns the same. Is there a reason you don't use "report" instead of the value of "report" as the key?

Contributor

salsakran commented May 4, 2017

We don't show all columns for every row. We expect the documents in a Mongo collection to all effectively have the same schema.

If you have a per-collection specific key, we won't find and display most of those. In general, I'd recommend naming all the columns the same. Is there a reason you don't use "report" instead of the value of "report" as the key?

@Densol92

This comment has been minimized.

Show comment
Hide comment
@Densol92

Densol92 May 4, 2017

My first structure was

  • REPORT_NAME_1
    • DATE_1
      • SOME_DATA_1
      • SOME_DATA_2
    • DATE_2
      • SOME_DATA_1
      • SOME_DATA_2
  • REPORT_NAME_2 ...

But query builder not recognize nested fields - #1328 , #4098 so i still need to do custom query on my own.

Densol92 commented May 4, 2017

My first structure was

  • REPORT_NAME_1
    • DATE_1
      • SOME_DATA_1
      • SOME_DATA_2
    • DATE_2
      • SOME_DATA_1
      • SOME_DATA_2
  • REPORT_NAME_2 ...

But query builder not recognize nested fields - #1328 , #4098 so i still need to do custom query on my own.

@theage

This comment has been minimized.

Show comment
Hide comment
@theage

theage Sep 12, 2017

This behavior becomes an issue if you e.g. aggregate into documents where not all documents have all the same properties. If the first document is missing them, there is no way to make them visible other than adding those properties to all results (or at least the first returned one).

It would be nice if we could add custom properties / columns in the column selection dialog, e.g. via text box (which would be rendered as empty / undefined if they are missing).

theage commented Sep 12, 2017

This behavior becomes an issue if you e.g. aggregate into documents where not all documents have all the same properties. If the first document is missing them, there is no way to make them visible other than adding those properties to all results (or at least the first returned one).

It would be nice if we could add custom properties / columns in the column selection dialog, e.g. via text box (which would be rendered as empty / undefined if they are missing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment