Search...
not( )
Adds an not
condition to the query.
Description
The not()
function adds a not
condition to an EventsQueryBuilder
. A query
with a not
returns all the items that match the query as defined up to
the not
function, but don't match the query passed to the not
function.
If the query only contains a not()
function, it returns all the items
that don't match the query defined by the not
method.
Syntax
function not(query: EventsQueryBuilder): EventsQueryBuilder
not Parameters
NAME
TYPE
DESCRIPTION
Was this helpful?
Add a
not
filter to a queryCopy Code
1const newQuery = query1.not(query2);
Create a query, add a
not
filter, and run itThe results for this query do not contain any events for advanced attendees. This is determined by looking for titles that contain the string "advanced."
Copy Code
1import { wixEvents } from 'wix-events-backend';23// ...45wixEvents.queryEvents()6 .not(wixEvents.queryEvents().contains("title", "advanced"))7 .find()8 .then((results) => {9 if (results.items.length > 0) {10 const items = results.items;11 const firstItem = items[0];12 const totalCount = results.totalCount;13 const pageSize = results.pageSize;14 const currentPage = results.currentPage;15 const totalPages = results.totalPages;16 const hasNext = results.hasNext();17 const hasPrev = results.hasPrev();18 const length = results.length;19 const query = results.query;20 } else {21 // handle case where no matching items found22 }23 })24 .catch((error) => {25 const queryError = error;26 });