
Parsifly Docs
ICollection
ICollection Represents a reference to a Collection of Documents.
parsifly-extension-base / index / ICollection
Interface: ICollection<T>
Defined in: lib/data-providers/index.ts:119
ICollection Represents a reference to a Collection of Documents.
Type Parameters
T
T
The type of the documents within the collection.
Methods
add()
add(
data):Promise<void>
Defined in: lib/data-providers/index.ts:135
Adds a new Document to the Collection.
Parameters
data
T
The data for the new document.
Returns
Promise<void>
A Promise that resolves when the operation is complete.
Example
await provider.collection<IPage>('pages').add({ name: 'New Page', content: '...' });
doc()
doc(
id):IDoc<T>
Defined in: lib/data-providers/index.ts:154
Gets a reference to a specific Document within the Collection by its ID.
Parameters
id
string
The ID of the document.
Returns
IDoc<T>
An IDoc reference.
Example
const pageDoc = provider.collection<IPage>('pages').doc('page-123');
onValue()
onValue(
callback):Promise<ISubscription>
Defined in: lib/data-providers/index.ts:145
Subscribes to real-time updates for the entire Collection (list changes).
Parameters
callback
(value) => Promise<void>
The function to call when the list of documents changes.
Returns
An object with an unsubscribe method.
Example
const sub = await provider.collection<IPage>('pages').onValue(list => console.log('List updated:', list.length));
await sub.unsubscribe();
value()
value():
Promise<T[]>
Defined in: lib/data-providers/index.ts:126
Retrieves all Documents in the Collection.
Returns
Promise<T[]>
A Promise that resolves with an array of documents.
Example
const pages = await provider.collection<IPage>('pages').value();