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

Use the Query format for string representations of sets #46

Open
bmomberger-bitovi opened this issue May 20, 2019 · 0 comments
Open

Use the Query format for string representations of sets #46

bmomberger-bitovi opened this issue May 20, 2019 · 0 comments

Comments

@bmomberger-bitovi
Copy link

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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants