Skip to content

Exclude rows that by filtering out via columns with specific set contents #268

@MHOOO

Description

@MHOOO

Is there some way to exclude content from a query, for example by writing something similar to this non functional query:

await triplit.fetch(triplit.query('content').where(['tags.name', '!=', 'TagIDoNotWant']).limit(5).build())

given this schema?

{
	tags: {
		schema: S.Schema({
			id: S.Id(),
			name: S.String(),
		})
	},
	content: {
		schema: S.Schema({
			id: S.Id(),
			url: S.String(),
			tags: S.RelationMany('tags', {
				where: [['id', 'in', '$tag_ids']]
			}),
			tag_ids: S.Optional(S.Set(S.String())),
		})
	}
}

I've tried:

  • nin instead of != ⇒ simply appears to ignore the where clause
  • nin with the tag name on the left side of the where clause (i.e. .where(['TagIDoNotWant', 'nin', 'tags.name']) ⇒ exception due to it being an invalid query
  • Manually removing entries after the query. While this works, it requires me to query again & again with growing limits, until I find enough entries to satisfy the actual passed limit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions