Skip to content

Use the Query format for string representations of sets #46

Open
@bmomberger-bitovi

Description

@bmomberger-bitovi

A previous design decision used the user format of list sets to represent lists in the can-connect list store.

I.e. if the user makes a Query with the feathers format like

            let query = {
              $limit: -1,
              $sort: { datetime: 1 },
              datetime: { $gt: new Date(since) },
              trackerId: this.tracker._id
            }

This object would be serialized into the key in the list store that stored the returned list.

There are some limitations to this approach. If query formats contain exotic objects or user defined types, we may have a problem with turning them into appropriate string representations. We already saw this happening when using raw Date objects, for example.

For robustness, we should instead key our list sets on the processed can-query-logic representation of queries instead of the "raw" user-supplied version. This will allow converters for exotic or complex data types to run before attempting to sort and stringify the object representation. The example above would be converted to a BasicQuery representation as such:

{
  filter: {
    $and: [
      {
        datetime: {
          $gt: "2019-05-20T18:52:16.818Z"
         }
       },
       {
         trackerId: "1001"
       }
    ]
  },
  page: {
    start: 0,
    end: -2
  },
  sort: "datetime"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions