Deletes a document from the specified collection in Firestore.
Throws an exception with an error message if an error occurs.
import { firestore } from 'firebase-admin'import * as admin from 'firebase-admin'import { remove } from '@skeet-framework/firestore'const db = admin.firestore();async function run() { try { const path = 'Users' const docId = '123456'; // Assuming this ID exists in the Users collection. const success = await remove(db, path, docId); if (success) { console.log(`Document with ID ${docId} deleted successfully.`); } } catch (error) { console.error(`Error deleting document: ${error}`); }}run(); Copy
import { firestore } from 'firebase-admin'import * as admin from 'firebase-admin'import { remove } from '@skeet-framework/firestore'const db = admin.firestore();async function run() { try { const path = 'Users' const docId = '123456'; // Assuming this ID exists in the Users collection. const success = await remove(db, path, docId); if (success) { console.log(`Document with ID ${docId} deleted successfully.`); } } catch (error) { console.error(`Error deleting document: ${error}`); }}run();
The instance of the Firestore database to use.
The path of the collection containing the document to be deleted.
The ID of the document to be deleted.
A boolean indicating the success of the delete operation.
Generated using TypeDoc
Deletes a document from the specified collection in Firestore.
Throws
Throws an exception with an error message if an error occurs.
Example