2021-02-13 14:15:59 +01:00
|
|
|
/// <reference types="node" />
|
|
|
|
import "./MongoBigInt";
|
|
|
|
import mongoose, { Collection } from "mongoose";
|
|
|
|
import { ChangeStream, ChangeEvent } from "mongodb";
|
|
|
|
import EventEmitter from "events";
|
|
|
|
declare const _default: mongoose.Connection;
|
|
|
|
export default _default;
|
|
|
|
export interface MongooseCache {
|
|
|
|
on(event: "delete", listener: (id: string) => void): this;
|
|
|
|
on(event: "change", listener: (data: any) => void): this;
|
|
|
|
on(event: "insert", listener: (data: any) => void): this;
|
|
|
|
on(event: "close", listener: () => void): this;
|
|
|
|
}
|
|
|
|
export declare class MongooseCache extends EventEmitter {
|
|
|
|
collection: Collection;
|
|
|
|
pipeline: Array<Record<string, unknown>>;
|
|
|
|
opts: {
|
|
|
|
onlyEvents: boolean;
|
|
|
|
};
|
|
|
|
stream: ChangeStream;
|
|
|
|
data: any;
|
|
|
|
constructor(collection: Collection, pipeline: Array<Record<string, unknown>>, opts: {
|
|
|
|
onlyEvents: boolean;
|
|
|
|
});
|
2021-04-06 03:56:19 +02:00
|
|
|
init: () => Promise<void>;
|
|
|
|
convertResult: (obj: any) => any;
|
2021-02-13 14:15:59 +01:00
|
|
|
change: (doc: ChangeEvent) => boolean | Promise<any> | undefined;
|
2021-04-06 03:56:19 +02:00
|
|
|
destroy: () => Promise<any> | undefined;
|
2021-02-13 14:15:59 +01:00
|
|
|
}
|