API reference
exists
Checks if a document exists in the specified collection based on the given path.
Parameters
| Prop | Type | Description |
|---|---|---|
path | string | The path to the document, which includes the collection name and document ID. The path should follow the format: 'collectionName/id'. |
Returns
- A promise that resolves to
trueif the document exists, orfalseotherwise.
Example
js
const exists = await db.exists("users/generated-id");
console.log(exists); // Output: true or false