mongo-oplog2
Version:
Simple monitoring of MongoDB oplog.
26 lines (25 loc) • 957 B
TypeScript
import { Cursor, Db, Timestamp } from "mongodb";
import { OplogDoc, OplogQuery } from "./util";
interface GetStreamOptions {
db?: Db;
ns?: string;
ts?: number | Timestamp;
coll?: string;
filter?: OplogQuery;
}
/**
* Obtain a cursor stream for the oplog.
* @param db database connection
* @param ns optional namespace for filtering of documents returned
* @param ts timestamp to start from. No specified timestamp is treated as from now.
* @param coll collection for the oplog. (default: "oplog.rs")
*/
export declare function getStream({ db, ns, ts, coll, filter }?: GetStreamOptions): Promise<Cursor>;
/**
* Retrieves the last document from the capped collection.
* @param db database connection
* @param ns optional namespace for filtering of ducoments returned
* @param coll collection to query (default: "oplog.rs")
*/
export declare function getLastDoc(db?: Db, ns?: string, coll?: string): Promise<OplogDoc>;
export {};