queryPublicPlans( )


Creates a query to retrieve a list of public pricing plans.

The queryPublicPlans() function builds a query to retrieve a list of up to 1,000 public plans and returns a PublicPlansQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining PublicPlansQueryBuilder functions onto the query. PublicPlansQueryBuilder functions enable you to sort, filter, and control the results that queryPublicPlans() returns.

queryPublicPlans() runs with the following PublicPlansQueryBuilder defaults that you can override:

The functions that are chained to queryPublicPlans() are applied in the order they are called. For example, if you sort on the _createdDate property in ascending order and then on the _id property in ascending order, the results are sorted first by the created date of the items and then, if there are multiple results with the same date, the items are sorted by _id in ascending order, per created date value.

The following PublicPlansQueryBuilder functions are supported for queryPublicPlans().

PropertyFiltersExamples
_ideq(), ne(), hasSome()hasSome("_id", ["46ce4cd4-46ff-13a1-43ac-02fd4f0f3209", "94ce4cd4-46cc-20c3-4c7a-03fd4f0f3306"])
primaryeq(), ne(), ascending(), descending()eq("primary",true)
slugeq(), ne(), startsWith(), endsWith(), contains(), ascending(), descending()eq("gold")
_createdDateeq(), ne(), gt(), ge(), lt(), le(), between(), ascending(), descending()lt("_createdDate", "2020-04-27T10:00:00.000Z")
_updatedDateeq(), ne(), gt(), ge(), lt(), le(), between(), ascending(), descending()ge("_updatedDate", "2020-04-27T10:00:00.000Z")

Notes:

  • When using the queryPublicPlans() function immediately following a change to your plans, the data retrieved may not contain your most recent changes. See Wix-data and Eventual Consistency for more information. To solve this problem, you can use the setTimeout() function to delay querying following any changes to your plan data. The find() function executes the query based on this query object, and returns the actual result, PublicPlansQueryResult.
  • You do not need "Manage Pricing Plans" permissions to query public plans.
Method Declaration
Copy
Request
This method does not take any parameters
Did this help?