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
true
if the document exists, orfalse
otherwise.
Example
js
const db = new Naro("myDatabase");
const exists = await db.exists("users/generated-id");
console.log(exists); // Output: true or false