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.
I'm trying to build a filter mechanism. I have this function:
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.paramsis 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.