# Collection: list() method

> The list() method of the Collection interface resolves with a page of entries, without their values.

The **`list()`** method of the [`Collection`](/docs/room/collection) interface resolves with a page of entries, each without its value.

## Syntax

```ts
list()
list(options)
```

### Parameters

`options` Optional
: An object with any of these properties:

  `where`
  : `meta` keys and values that every entry listed has, matched by equality.

  `owner`
  : Only this player's entries.

  `order`
  : `"score"`, `"-score"`, `"created"`, `"-created"`, `"updated"` or `"-updated"`. Defaults to `"-created"`, newest first.

  `limit`
  : The most entries in the page, from 1 to 100. Defaults to 20.

  `after`
  : The `next` of the page before, for the page after it.

### Return value

A `Promise` that resolves with `{ entries, next }`. Each entry has the properties [`get()`](/docs/room/collection/get) gives but `value`. `next` is `null` on the last page.

### Exceptions

The promise rejects with a [`DataError`](/docs/room/data-error), such as `E_INVALID` for a `limit` out of range.

## Description

Ties go by `id`, and entries without a score come last in both score orders. `list()` is never cached, so call it on an event or every few seconds, not every tick.

## Examples

### Showing the highest-rated levels

```ts
// browse.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  async onMessage(room, connection, message) {
    const m = message as { type?: string; after?: string | null };
    if (m.type !== "browse") return;
    const page = await room.collection("levels").list({ where: { theme: "lava" }, order: "-score", limit: 10, after: m.after ?? null });
    room.send(connection, { type: "levels", ids: page.entries.map((e) => e.id), next: page.next });
  },
});
```

## See also

- [`Collection.get()`](/docs/room/collection/get), for an entry's value
