Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/hex/src/lib/data/deps.ts>mongo.Database

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
class mongo.Database
import { mongo } from "https://deno.land/x/hex@0.6.5/src/lib/data/deps.ts";
const { Database } = mongo;

Constructors

new
Database(cluster: Cluster, name: string)

Methods

collection<T = Document>(name: string): Collection<T>
createCollection<T>(name: string, options?: CreateCollectionOptions): Promise<Collection<T>>

createCollection executes a create command to create a new collection with the specified name and options.

https://www.mongodb.com/docs/manual/reference/command/create/#mongodb-dbcommand-dbcmd.create

createUser(
username: string,
password: string,
)
dropDatabase(writeConcern?: WriteConcern)
dropUser(username: string, options?: { writeConcern?: Document; comment?: Document; })
listCollectionNames(options?: { filter?: Document; authorizedCollections?: boolean; comment?: Document; }): Promise<string[]>
listCollections(options?: { filter?: Document; nameOnly?: boolean; authorizedCollections?: boolean; comment?: Document; }): CommandCursor<ListCollectionsResult>