import { Collection } from "https://deno.land/x/mongo@v0.33.0/src/collection/mod.ts";
A collection within a MongoDB Database
Methods
countDocuments(filter?: Filter<T>, options?: CountOptions): Promise<number>
Count the number of documents matching the given filter
createIndexes(options: CreateIndexOptions): Promise<{ ok: number; createdCollectionAutomatically: boolean; numIndexesBefore: number; numIndexesAfter: number; }>
Create an index on the collection
deleteMany(filter: Filter<T>, options?: DeleteOptions): Promise<number>
Delete multiple documents matching the given filter
dropIndexes(options: DropIndexOptions): Promise<{ ok: number; nIndexesWas: number; }>
Drop an index from the collection
estimatedDocumentCount(): Promise<number>
A function that returns the estimated number of documents in the collection
findAndModify(filter?: Filter<T>, options?: FindAndModifyOptions<T>): Promise<T | null>
Find and modify a document in one, returning the matching document.
insertMany(docs: InsertDocument<T>[], options?: InsertOptions): Promise<{ insertedIds: Required<InsertDocument<T>>["_id"][]; insertedCount: number; }>
Insert multiple documents into the collection
insertOne(doc: InsertDocument<T>, options?: InsertOptions): Promise<Required<InsertDocument<T>>["_id"]>
Insert a single document into the collection
listIndexes(): ListIndexesCursor<{ v: number; key: Document; name: string; ns?: string; }>
List the indexes on the collection
replaceOne(): Promise<{ upsertedId: ObjectId | undefined; upsertedCount: number; matchedCount: number; modifiedCount: number; }>
Replace a single document matching the given filter
updateMany(): Promise<{ upsertedIds: ObjectId[] | undefined; upsertedCount: number; modifiedCount: number; matchedCount: number; }>
Update multiple documents matching the given filter