import { MongoClient, Db, Collection as MongoCollection } from "mongodb"; import type Collection from "../chip-types/collection.js"; import type { QueryStage } from "./query.js"; import Datastore from "./datastore-abstract.js"; export type OutputOptions = Partial<{ skip: number; amount: number; sort: { [field_name: string]: -1 | 1; }; }>; export default class MongoDatastore extends Datastore { client: MongoClient; db: Db; start(): Promise; post_start(): Promise; create_index(collection: Collection): Promise; find(collection_name: string, query: Record, options?: Parameters[1], output_options?: OutputOptions): Promise[]>; aggregate(collection_name: string, pipeline: QueryStage[], _?: {}, output_options?: OutputOptions): Promise[]>; insert(collection_name: string, to_insert: Record, options?: Parameters[1]): Promise>; update(collection_name: string, query: any, new_value: any): Promise>; remove(collection_name: string, query: any, just_one: boolean): Promise; createIndex(collection_name: string, index: any, options?: Parameters[1]): Promise; stop(): Promise; }