> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Database

> Facebook local sync: searchable entities, `.search()` filters, and operators.

The Facebook plugin syncs data locally. Use `corsair.facebook.db.<entity>.search({ data, limit?, offset? })` with the filters listed per entity.

<Info>
  **New to Corsair?** See [database operations](/concepts/database), [data synchronization](/concepts/integrations), and [multi-tenancy](/concepts/multi-tenancy).
</Info>

## Albums

Path: `facebook.db.albums.search`

```ts theme={null}
const rows = await corsair.facebook.db.albums.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field         | Type     | Operators                                  |
| ------------- | -------- | ------------------------------------------ |
| `entity_id`   | `string` | equals, contains, startsWith, endsWith, in |
| `albumId`     | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`      | `string` | equals, contains, startsWith, endsWith, in |
| `name`        | `string` | equals, contains, startsWith, endsWith, in |
| `description` | `string` | equals, contains, startsWith, endsWith, in |
| `photoCount`  | `number` | equals, gt, gte, lt, lte, in               |
| `link`        | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`   | `date`   | equals, before, after, between             |
| `updatedAt`   | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Comments

Path: `facebook.db.comments.search`

```ts theme={null}
const rows = await corsair.facebook.db.comments.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field         | Type      | Operators                                  |
| ------------- | --------- | ------------------------------------------ |
| `entity_id`   | `string`  | equals, contains, startsWith, endsWith, in |
| `commentId`   | `string`  | equals, contains, startsWith, endsWith, in |
| `objectId`    | `string`  | equals, contains, startsWith, endsWith, in |
| `message`     | `string`  | equals, contains, startsWith, endsWith, in |
| `createdTime` | `string`  | equals, contains, startsWith, endsWith, in |
| `authorId`    | `string`  | equals, contains, startsWith, endsWith, in |
| `authorName`  | `string`  | equals, contains, startsWith, endsWith, in |
| `isHidden`    | `boolean` | equals                                     |
| `createdAt`   | `date`    | equals, before, after, between             |
| `updatedAt`   | `date`    | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Conversations

Path: `facebook.db.conversations.search`

```ts theme={null}
const rows = await corsair.facebook.db.conversations.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field            | Type     | Operators                                  |
| ---------------- | -------- | ------------------------------------------ |
| `entity_id`      | `string` | equals, contains, startsWith, endsWith, in |
| `conversationId` | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`         | `string` | equals, contains, startsWith, endsWith, in |
| `updatedTime`    | `string` | equals, contains, startsWith, endsWith, in |
| `messageCount`   | `number` | equals, gt, gte, lt, lte, in               |
| `unreadCount`    | `number` | equals, gt, gte, lt, lte, in               |
| `snippet`        | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`      | `date`   | equals, before, after, between             |
| `updatedAt`      | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Insights

Path: `facebook.db.insights.search`

```ts theme={null}
const rows = await corsair.facebook.db.insights.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field       | Type     | Operators                                  |
| ----------- | -------- | ------------------------------------------ |
| `entity_id` | `string` | equals, contains, startsWith, endsWith, in |
| `insightId` | `string` | equals, contains, startsWith, endsWith, in |
| `objectId`  | `string` | equals, contains, startsWith, endsWith, in |
| `name`      | `string` | equals, contains, startsWith, endsWith, in |
| `period`    | `string` | equals, contains, startsWith, endsWith, in |
| `endTime`   | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt` | `date`   | equals, before, after, between             |
| `updatedAt` | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Messages

Path: `facebook.db.messages.search`

```ts theme={null}
const rows = await corsair.facebook.db.messages.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field            | Type     | Operators                                  |
| ---------------- | -------- | ------------------------------------------ |
| `entity_id`      | `string` | equals, contains, startsWith, endsWith, in |
| `messageId`      | `string` | equals, contains, startsWith, endsWith, in |
| `conversationId` | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`         | `string` | equals, contains, startsWith, endsWith, in |
| `message`        | `string` | equals, contains, startsWith, endsWith, in |
| `createdTime`    | `string` | equals, contains, startsWith, endsWith, in |
| `senderId`       | `string` | equals, contains, startsWith, endsWith, in |
| `senderName`     | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`      | `date`   | equals, before, after, between             |
| `updatedAt`      | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Page Roles

Path: `facebook.db.pageRoles.search`

```ts theme={null}
const rows = await corsair.facebook.db.pageRoles.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field       | Type     | Operators                                  |
| ----------- | -------- | ------------------------------------------ |
| `entity_id` | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`    | `string` | equals, contains, startsWith, endsWith, in |
| `userId`    | `string` | equals, contains, startsWith, endsWith, in |
| `name`      | `string` | equals, contains, startsWith, endsWith, in |
| `role`      | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt` | `date`   | equals, before, after, between             |
| `updatedAt` | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Pages

Path: `facebook.db.pages.search`

```ts theme={null}
const rows = await corsair.facebook.db.pages.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field         | Type     | Operators                                  |
| ------------- | -------- | ------------------------------------------ |
| `entity_id`   | `string` | equals, contains, startsWith, endsWith, in |
| `facebookId`  | `string` | equals, contains, startsWith, endsWith, in |
| `name`        | `string` | equals, contains, startsWith, endsWith, in |
| `accessToken` | `string` | equals, contains, startsWith, endsWith, in |
| `category`    | `string` | equals, contains, startsWith, endsWith, in |
| `about`       | `string` | equals, contains, startsWith, endsWith, in |
| `link`        | `string` | equals, contains, startsWith, endsWith, in |
| `phone`       | `string` | equals, contains, startsWith, endsWith, in |
| `website`     | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`   | `date`   | equals, before, after, between             |
| `updatedAt`   | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Photos

Path: `facebook.db.photos.search`

```ts theme={null}
const rows = await corsair.facebook.db.photos.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field         | Type     | Operators                                  |
| ------------- | -------- | ------------------------------------------ |
| `entity_id`   | `string` | equals, contains, startsWith, endsWith, in |
| `photoId`     | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`      | `string` | equals, contains, startsWith, endsWith, in |
| `albumId`     | `string` | equals, contains, startsWith, endsWith, in |
| `name`        | `string` | equals, contains, startsWith, endsWith, in |
| `source`      | `string` | equals, contains, startsWith, endsWith, in |
| `link`        | `string` | equals, contains, startsWith, endsWith, in |
| `createdTime` | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`   | `date`   | equals, before, after, between             |
| `updatedAt`   | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Posts

Path: `facebook.db.posts.search`

```ts theme={null}
const rows = await corsair.facebook.db.posts.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                  | Type      | Operators                                  |
| ---------------------- | --------- | ------------------------------------------ |
| `entity_id`            | `string`  | equals, contains, startsWith, endsWith, in |
| `postId`               | `string`  | equals, contains, startsWith, endsWith, in |
| `pageId`               | `string`  | equals, contains, startsWith, endsWith, in |
| `message`              | `string`  | equals, contains, startsWith, endsWith, in |
| `createdTime`          | `string`  | equals, contains, startsWith, endsWith, in |
| `isPublished`          | `boolean` | equals                                     |
| `permalinkUrl`         | `string`  | equals, contains, startsWith, endsWith, in |
| `scheduledPublishTime` | `number`  | equals, gt, gte, lt, lte, in               |
| `createdAt`            | `date`    | equals, before, after, between             |
| `updatedAt`            | `date`    | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Reactions

Path: `facebook.db.reactions.search`

```ts theme={null}
const rows = await corsair.facebook.db.reactions.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field       | Type     | Operators                                  |
| ----------- | -------- | ------------------------------------------ |
| `entity_id` | `string` | equals, contains, startsWith, endsWith, in |
| `objectId`  | `string` | equals, contains, startsWith, endsWith, in |
| `userId`    | `string` | equals, contains, startsWith, endsWith, in |
| `name`      | `string` | equals, contains, startsWith, endsWith, in |
| `type`      | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt` | `date`   | equals, before, after, between             |
| `updatedAt` | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Users

Path: `facebook.db.users.search`

```ts theme={null}
const rows = await corsair.facebook.db.users.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field            | Type     | Operators                                  |
| ---------------- | -------- | ------------------------------------------ |
| `entity_id`      | `string` | equals, contains, startsWith, endsWith, in |
| `facebookUserId` | `string` | equals, contains, startsWith, endsWith, in |
| `name`           | `string` | equals, contains, startsWith, endsWith, in |
| `email`          | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`      | `date`   | equals, before, after, between             |
| `updatedAt`      | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Videos

Path: `facebook.db.videos.search`

```ts theme={null}
const rows = await corsair.facebook.db.videos.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field          | Type     | Operators                                  |
| -------------- | -------- | ------------------------------------------ |
| `entity_id`    | `string` | equals, contains, startsWith, endsWith, in |
| `videoId`      | `string` | equals, contains, startsWith, endsWith, in |
| `pageId`       | `string` | equals, contains, startsWith, endsWith, in |
| `title`        | `string` | equals, contains, startsWith, endsWith, in |
| `description`  | `string` | equals, contains, startsWith, endsWith, in |
| `source`       | `string` | equals, contains, startsWith, endsWith, in |
| `permalinkUrl` | `string` | equals, contains, startsWith, endsWith, in |
| `createdTime`  | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`    | `date`   | equals, before, after, between             |
| `updatedAt`    | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***
