Skip to content

Unclear or non-working where function for query with date field #350

@pandabrand

Description

@pandabrand

I'm trying to build a filter mechanism. I have this function:

    const filter = (filters: IFilter[]) => {
        const queries: any[] = []

        filters.forEach((field) => {
            queries.push(
                stack
                .contentType(contentType)
                .entry()
                .query()
                .where(field.uid, QueryOperation.INCLUDES, field.params)
            )
        })

        query.queryOperator(QueryOperator.OR, ...queries)

        query
        .includeCount()
        .paginate({skip: 0, limit: perPage})
        .orderByDescending(sortField)
        .find()
        .then((res) => {
            dispatch({
                type: 'ADD_ENTRIES',
                payload: {
                    entries: res.entries ?? [],
                    count: res.count ?? 0
                }
            })
        })
    }

I can't find any documentation whether the date field is stored as a string or a number. In the example I'm testing the field.params is carrying an array of years as a string. I have also tried converting to an int. I always get an empty result. Since I can't find any documentation to verify whether or not this is correct, I'm also reaching out in case this is an issue.

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