Skip to main content
Module

x/atlas_sdk/client.ts>Collection

TypeSafe MongoDB Atlas Data API SDK for Deno, Deno Deploy and Node.js
Latest
class Collection
import { Collection } from "https://deno.land/x/atlas_sdk@v1.1.3/client.ts";

Constructors

new
Collection(name: string, database: Database)

Properties

client: MongoClient
database: Database
name: string

Methods

aggregate<T = Document>(pipeline: Document[]): Promise<T[]>
callApi(method: string, extra: Document): Promise<any>
countDocuments(filter?: Document, options?: { limit?: number; skip?: number; }): Promise<number>
deleteMany(filter: Document): Promise<{ deletedCount: number; }>
deleteOne(filter: Document): Promise<{ deletedCount: number; }>
estimatedDocumentCount(): Promise<number>
find(filter?: Document, unnamed 1?: { projection?: Document; sort?: Document; limit?: number; skip?: number; }): Promise<T[]>
findOne(filter: Document, unnamed 1?: { projection?: Document; }): Promise<T>
insertMany(docs: T[]): Promise<{ insertedIds: string[]; }>
insertOne(doc: T): Promise<{ insertedId: string; }>
replaceOne(
filter: Document,
replacement: Document,
unnamed 2?: { upsert?: boolean; },
): Promise<{ matchedCount: number; modifiedCount: number; upsertedId?: string; }>
updateMany(
filter: Document,
update: Document,
unnamed 2?: { upsert?: boolean; },
): Promise<{ matchedCount: number; modifiedCount: number; upsertedId?: string; }>
updateOne(
filter: Document,
update: Document,
unnamed 2?: { upsert?: boolean; },
): Promise<{ matchedCount: number; modifiedCount: number; upsertedId?: string; }>