Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Taglist api returns a null string when an article exists without a taglist + performance once db grows #47

Open
quantuminformation opened this issue Oct 8, 2019 · 1 comment

Comments

@quantuminformation
Copy link

I have the following data for articles:

Screenshot 2019-10-08 at 19 21 06

When running this query:
const tags = (await ds.createQuery(namespace, 'Article').select('tagList').run())[0];

Will return
Screenshot 2019-10-08 at 19 22 44

I feel that we should not return this null item. Or the client should handle it.

what do you think?

@quantuminformation quantuminformation changed the title Taglist api returns a null string when an article exists without a taglist Taglist api returns a null string when an article exists without a taglist + performance once db grows Oct 8, 2019
@quantuminformation
Copy link
Author

Also, this query will retrieve every taglist from every article. Would it not be better to filter them at the db level instead of performing the filtering on the cloud function.

  async getAllTags() {
    const tags = (await ds.createQuery(namespace, 'Article').select('tagList').run())[0];
    const dedupeObj = {};
    for (let i = 0; i < tags.length; ++i) {
      dedupeObj[tags[i].tagList] = 1;
    }
    return Object.keys(dedupeObj);
  },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant