> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: queryMembers(options: QueryMembersOptions)

# Method package: wixMembersV2

# Method menu location: wixMembersV2 --> members --> queryMembers

# Method Link: https://dev.wix.com/docs/velo/apis/wix-members-v2/members/query-members.md

# Method Description:

Retrieves a list of up to 100 members, given the provided filters, fieldsets, sorting and paging, and returns a `MembersQueryBuilder` 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 `MembersQueryBuilder` functions onto the query. `MembersQueryBuilder` functions enable you to sort, filter, and control the results that `queryMembers()` returns. The functions that are chained to `queryMembers()` are applied in the order they are called. 

`queryMembers()` runs with the following `MembersQueryBuilder` defaults that you can override:
- `skip`: `0`
- `limit`: `50`

Currently supported fields for sorting: 
- `profile.nickname`
- `contact.firstName`
- `contact.lastName`
- `createdDate`
- `lastLoginDate`

The following `MembersQueryBuilder` functions are supported for the `queryMembers()` function. For a full description of the Locations object, see the returned for the `items` property in `MembersQueryResult`. 


|PROPERTY	|SUPPORTED FILTERS & SORTING	
|:---:|:---:|
|`_id`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`loginEmail`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`contactId`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`contact.firstName`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`contact.lastName`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`profile.nickname`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`profile.slug`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some),[`startsWith()`](/members-query-builder/starts-with)|
|`privacyStatus`|[`eq()`](/members-query-builder/eq),[`ne()`](/members-query-builder/ne),[`exists()`](/members-query-builder/exists),[`in()`](/members-query-builder/in),[`hasSome()`](/members-query-builder/has-some)|



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Query member's with all option parameters (export from backend code)

```javascript
import { members } from 'wix-members.v2';
import { webMethod, Permissions } from 'wix-web-module';

/* Sample parameter values
 * {
 *   "options": {
 *       "fieldsets": ["EXTENDED"],
 *       "search": {
 *           "expression": "John Doe"
 *       },
 *       "fields": [
 *           "loginEmail",
 *           "contact.firstName",
 *           "contact.lastName",
 *           "profile.title",
 *           "profile.nickname",
 *           "profile.slug"
 *       ]
 *   }
 * }
 */

export const myQueryMembersFunction = webMethod(
  Permissions.Anyone,
  async (options) => {
    try {
      const siteMembers = await members.queryMembers(options).find();
      console.log('Retrieved members:', siteMembers);

      return siteMembers;
    } catch (error) {
      console.error(error);
      // Handle the error
    }
  }
);

/* Promise resolves to:
 * {
 *   "_items": [
 *     {
 *       "loginEmail": "newmember1@example.com",
 *       "loginEmailVerified": false,
 *       "status": "APPROVED",
 *       "contactId": "bbfa3373-9bc0-4479-9766-40e9ff4b6661",
 *       "contact": {
 *         "contactId": "bbfa3373-9bc0-4479-9766-40e9ff4b6661",
 *         "phones": [],
 *         "emails": [],
 *         "addresses": [],
 *         "customFields": {}
 *       },
 *       "profile": {
 *         "nickname": "John Doe",
 *         "slug": "newmember1"
 *       },
 *       "privacyStatus": "PUBLIC",
 *       "activityStatus": "ACTIVE",
 *       "_id": "bbfa3373-9bc0-4479-9766-40e9ff4b6661",
 *       "_createdDate": "2024-03-01T13:12:43.000Z",
 *       "_updatedDate": "2024-03-01T13:12:43.459Z"
 *     }
 *   ],
 *   "_originQuery": {
 *     "filterTree": {
 *       "$and": []
 *     },
 *     "invalidArguments": [],
 *     "encoder": {},
 *     "transformationPaths": {},
 *     "sort": [],
 *     "paging": {},
 *     "pagingMethod": "OFFSET",
 *     "builderOptions": {
 *       "cursorWithEmptyFilterAndSort": true
 *     }
 *   },
 *   "_limit": 50,
 *   "_totalCount": 1,
 *   "_offset": 0,
 *   "_tooManyToCount": false
 * }
 */ 
```

---