Skip to content
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

Change the doc reference format #504

Closed
n-sviridenko opened this issue Sep 18, 2021 · 4 comments
Closed

Change the doc reference format #504

n-sviridenko opened this issue Sep 18, 2021 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@n-sviridenko
Copy link
Contributor

Currently, the doc reference is an array of the document snapshots which are impossible to query by if needed to filter the entities which are having those.

I.e. I have a collection with candidates:

{
  "name": "John Doe",
  "job": [{"docPath":"jobs/123","snapshot":{"name":"First job"}}]
}

{
  "name": "Bob Darwin",
  "job": [{"docPath":"jobs/243","snapshot":{"name":"Second job"}}]
}

They look user-friendly inside firetable, but I'm unable to query candidates by a specific job, as I have to filter them by the entire object (where('job', 'array-contains', {"docPath":"jobs/243","snapshot":{"name":"Second job"}})) which might change (e.g. I rename the job) while its snapshot will stay same.

The goal is to come up with something I'll be able to filter by.

P.S. How do the other firetable users solve this problem?

@n-sviridenko
Copy link
Contributor Author

@shamsmosowi @notsidney

@shamsmosowi
Copy link
Member

shamsmosowi commented Sep 26, 2021

Hi @n-sviridenko , while its not ideal currently the easiest way to solve firestore query limitations is by adding a derivative column that can transform the original column into something that is easier to query, you can find an example in the docs here.
We are considering multiple options to make it possible to query, such as allowing "job" to be a single object rather an array, by adding it as a column configuration option

@notsidney
Copy link
Contributor

Hi @n-sviridenko, our current plan is to add a setting for Connect Table to store a single value in the next release in October, so you can filter by job.docPath.

The default would be an array:

{
  "name": "John Doe",
  "job": [ { "docPath": "jobs/123", "snapshot": { "name": "First job" } } ]
}

and with single values:

{
  "name": "John Doe",
  "job": { "docPath": "jobs/123", "snapshot": { "name": "First job" } }
}

or if the value is cleared:

{
  "name": "John Doe",
  "job": null
}

This matches the values returned by Single Select.

@notsidney notsidney added the enhancement New feature or request label Sep 30, 2021
@notsidney notsidney added this to the v2.1 milestone Sep 30, 2021
@notsidney notsidney added the good first issue Good for newcomers label Oct 1, 2021
@notsidney notsidney removed the good first issue Good for newcomers label Oct 14, 2021
notsidney added a commit that referenced this issue Oct 15, 2021
* develop: (27 commits)
  Allow users to add custom options in Single and Multi Select fields
  add extensionsDocSync WIKI_LINK
  add new step-based extensions UI
  Side Drawer: scroll to selected cell and focus if available
  update missing rowy run url error copy
  fix last frozen row not showing selection outline
  error copy
  show error when rowyrun is called without a url
  useTableData: fix connect table becoming unclearable
  Color: remove unused code in side drawer field
  fix Side Drawer not loading the correct row’s values for some fields after clicking the navigation buttons
  Connect Table: support single selection without arrays (#504)
  PopoverCell: fix double causing cell to appear blank
  table onSnapshot: fix rows with missingRequiredFields already in the database being displayed
  Table settings: Show collection name in Copy columns from existing table dropdown
  add initial columns option to create table
  fix status operator
  Long Text field: support in-cell editing
  CellValidation: fix console error
  fix add row not adding to the top after deleting
  ...
@harinij
Copy link
Member

harinij commented Oct 18, 2021

Released in v2.1

@harinij harinij closed this as completed Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants