@fua/module.persistence.mongodb

1.0.0 • Public • Published

module.persistence.mongodb

Interface

MongoDBStore

interface MongoDBStore extends DataStore {
    size(): Promise<number>;

    match(subject?: Term, predicate?: Term, object?: Term, graph?: Term): Promise<Dataset>;

    add(quads: Quad | Iterable<Quad>): Promise<number>;
    addStream(stream: Readable<Quad>): Promise<number>;
    delete(quads: Quad | Iterable<Quad>): Promise<number>;
    deleteStream(stream: Readable<Quad>): Promise<number>;
    deleteMatches(subject?: Term, predicate?: Term, object?: Term, graph?: Term): Promise<number>;

    has(quads: Quad | Iterable<Quad>): Promise<boolean>;

    on(event: "added", callback: (quad: Quad) => void): this;
    on(event: "deleted", callback: (quad: Quad) => void): this;
    on(event: "error", callback: (err: Error) => void): this;
};

MongoDBStoreFactory

interface MongoDBStoreFactory extends DataStoreFactory {
    dataStore({ url: string, db: string, config: Object }): MongoDBStore;
    isDataStore(that: MongoDBStore | any): true | false;

    validSubject(that: Term | any): true | false;
    validPredicate(that: Term | any): true | false;
    validObject(that: Term | any): true | false;
    validGraph(that: Term | any): true | false;
    validQuad(that: Quad | any): true | false;

    buildIndex({ url: string, db: string, config: Object }): Promise<void>;
};

Readme

Keywords

none

Package Sidebar

Install

npm i @fua/module.persistence.mongodb

Weekly Downloads

8

Version

1.0.0

License

MIT

Unpacked Size

11.5 kB

Total Files

4

Last publish

Collaborators

  • pfoerdie