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

Support and/or conjunction for relations #5

Closed
4 tasks done
kirrg001 opened this issue Nov 8, 2018 · 1 comment
Closed
4 tasks done

Support and/or conjunction for relations #5

kirrg001 opened this issue Nov 8, 2018 · 1 comment
Labels

Comments

@kirrg001
Copy link
Contributor

kirrg001 commented Nov 8, 2018

Description

NQL should support and/or conjunctions for relations.

The SQL strategy is currently covered in TryGhost/NQL-old#1

e.g. You can pass a filter into NQL filter=tag:en+tag:de and mongo-knex will receive a mongo JSON object and needs to interpret this object with the help of #4. It has to attach the correct SQL queries.

Tasks

  • support one or some cases for OR conjunction case
  • support one or some cases for AND conjunction case
  • support all cases for OR conjunction
  • support all cases for AND conjunction
@kirrg001 kirrg001 self-assigned this Nov 8, 2018
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
  - tags.id IN (1,2)
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 9, 2018
refs TryGhost#5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
kirrg001 added a commit that referenced this issue Nov 13, 2018
refs #5

- supports for many to many relations:
  - tags.slug IN (animal)
  - featured:true AND tags.slug IN (animal)
  - tags.id IN (2,3)
@kirrg001 kirrg001 removed their assignment Nov 13, 2018
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 15, 2018
refs TryGhost#5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 15, 2018
refs TryGhost#5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 15, 2018
refs TryGhost#5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 15, 2018
refs TryGhost#5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 15, 2018
refs TryGhost#5

- $and: [{'tags.slug': 'animal'},{'tags.slug': {$nin: ['classic']}}]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5, refs TryGhost#7

- (tags.slug = animal and sort_order = 0) OR visibility:internal (group)
- tags.slug = animal OR sort_order = 0 OR visibility:internal
- (tags.slug is animal and sort_order is 0) and tags.visibility=public (group)
- tags.slug is animal and sort_order is 0 and tags.visibility=public
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5

- $and: [{'tags.slug': 'animal'},{'tags.slug': {$nin: ['classic']}}]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5, refs TryGhost#7

- (tags.slug = animal and sort_order = 0) OR visibility:internal (group)
- tags.slug = animal OR sort_order = 0 OR visibility:internal
- (tags.slug is animal and sort_order is 0) and tags.visibility=public (group)
- tags.slug is animal and sort_order is 0 and tags.visibility=public
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5

- $and: [{'tags.slug': 'animal'},{'tags.slug': {$nin: ['classic']}}]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5, refs TryGhost#7

- (tags.slug = animal and sort_order = 0) OR visibility:internal (group)
- tags.slug = animal OR sort_order = 0 OR visibility:internal
- (tags.slug is animal and sort_order is 0) and tags.visibility=public (group)
- tags.slug is animal and sort_order is 0 and tags.visibility=public
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5

- $and: [{'tags.slug': 'animal'},{'tags.slug': {$nin: ['classic']}}]
kirrg001 added a commit to kirrg001/mongo-knex that referenced this issue Nov 16, 2018
refs TryGhost#5, refs TryGhost#7

- (tags.slug = animal and sort_order = 0) OR visibility:internal (group)
- tags.slug = animal OR sort_order = 0 OR visibility:internal
- (tags.slug is animal and sort_order is 0) and tags.visibility=public (group)
- tags.slug is animal and sort_order is 0 and tags.visibility=public
kirrg001 added a commit that referenced this issue Nov 16, 2018
refs #5

- $and: [tags.slug:en, tags.slug:de]
kirrg001 added a commit that referenced this issue Nov 16, 2018
refs #5

- $and: [{'tags.slug': 'animal'},{'tags.slug': {$nin: ['classic']}}]
kirrg001 added a commit that referenced this issue Nov 16, 2018
refs #5, refs #7

- (tags.slug = animal and sort_order = 0) OR visibility:internal (group)
- tags.slug = animal OR sort_order = 0 OR visibility:internal
- (tags.slug is animal and sort_order is 0) and tags.visibility=public (group)
- tags.slug is animal and sort_order is 0 and tags.visibility=public
naz added a commit that referenced this issue Dec 4, 2018
…lations (#18)

refs #5
refs #7

- Improved group comparison operator check
- Improved negation handling in conjunctions that have conditions on the connecting table
- Added test cases where one of the properties is negated
- Added support for negation inside $and conjunction with joining table condition
@kirrg001
Copy link
Contributor Author

kirrg001 commented Dec 4, 2018

We just merged #18, which supports a couple of more cases for $and and $or conjunction.

I am closing this issue for now. If we discover new cases which are not covered, we just raise a new issue 👍

@kirrg001 kirrg001 closed this as completed Dec 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant