and( )


Adds an and condition to the query.

The and() function adds an and condition to a PublicPlansQueryBuilder. A query with an and returns all the items that match the query as defined up to the and function.

Note that when chaining multiple PublicPlansQueryBuilder functions to a query an and condition is assumed. In such cases, you do not need to add a call to the and() function. For example, this query returns results where the plan was created during a certain date range and the plan's slug starts with "gold" (such as gold, gold-vip, gold-trial).

Copy

The and() function is needed when performing compound queries. For example, the final query, typeAndDateQuery, in this set of queries returns results where a plan is created after a certain date, and the plan is either a "gold" or a "silver" membership plan, as defined in the plan's slug.

Copy

The 'and()' function is designed to work with 2 or more queries or filters. If you use it on its own, it will return all the items in a collection.

Method Declaration
Copy
Method Parameters

A query to add to the initial query as an and condition.

Returns
Did this help?