Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Feb 4, 2024
2 parents a0b9a5c + 1780a28 commit f7b20bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/build/datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const myList = await listDocs({
});
```

The function accepts various optional parameters, including a matcher (a regex applied to the document keys and descriptions), pagination options, and sorting order.
The function **accepts various optional parameters**, including a matcher (a regex applied to the document keys and descriptions), pagination options, and sorting order.

```javascript
import { listDocs } from "@junobuild/core";
Expand All @@ -246,6 +246,18 @@ Sorting can be applied descending or ascending to following fields:

Options `matcher`, `paginate` and `order` can be use together.

The function **returns various information**, in the form of an object whose interface is given below.

```typescript
{
items: []; // The data - array of documents
items_length: bigint; // The number of documents - basically items.length
items_page?: bigint; // If the query is paginated, at what page (starting from 0) do the items find the place
matches_length: bigint; // The total number of matching results
matches_pages?: bigint; // If the query is paginated, the total number (starting from 0) of pages
}
```

## Delete a document

To delete a document, use the `deleteDoc` function, which also performs timestamp validation to ensure that the most recent document is being deleted:
Expand Down
12 changes: 12 additions & 0 deletions docs/build/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ The `listAssets` function -- in addition to specifying the collection to query -
- `paginate`: an object used to query a subset of the assets
- `order`: requests entries sorted in ascending or descending order

The function **returns various information**, in the form of an object whose interface is given below.

```typescript
{
items: []; // The data - array of assets
items_length: bigint; // The number of assets - basically items.length
items_page?: bigint; // If the query is paginated, at what page (starting from 0) do the items find the place
matches_length: bigint; // The total number of matching results
matches_pages?: bigint; // If the query is paginated, the total number (starting from 0) of pages
}
```

## Delete asset

To delete an asset, you only need to provide its `fullPath`. Unlike the [datastore](datastore.md), there is no timestamp validation performed when deleting an asset.
Expand Down

0 comments on commit f7b20bd

Please sign in to comment.