Creates a new Db instance创建新的Db实例
The MongoClient for the database.数据库的MongoClient。
The name of the database this instance represents.此实例表示的数据库的名称。
Optional settings for Db constructionDb构造的可选设置
The current readPreference of the Db. Db的当前readPreference。If not explicitly defined for this Db, will be inherited from the parent MongoClient如果没有为此Db显式定义,将从父MongoClient继承
Check if a secondary can be used (because the read preference is not set to primary)检查是否可以使用辅助(因为读取首选项未设置为primary
)
slaveOk specified指定slaveOk
Add a user to the database将用户添加到数据库
The username for the new user新用户的用户名
Return the Admin db instance返回Admin数据库实例
Execute an aggregation framework pipeline against the database, needs MongoDB >= 3.6针对数据库执行聚合框架管道,需要MongoDB>=3.6
An array of aggregation stages to be executed要执行的聚合阶段数组
Optional settings for the command命令的可选设置
Returns a reference to a MongoDB Collection. 返回对MongoDB集合的引用。If it does not exist it will be created implicitly.如果它不存在,将隐式创建。
the collection name we wish to access.我们希望访问的集合名称。
return the new Collection instance
Fetch all collections for the current db.获取当前数据库的所有集合。
Execute a command执行命令
The command to run要运行的命令
Create a new collection on a server with the specified options. 使用指定的选项在服务器上创建新集合。Use this to create capped collections. 使用此选项可创建封顶集合。More information about command options available at https://docs.mongodb.com/manual/reference/command/create/有关命令选项的详细信息,请访问https://docs.mongodb.com/manual/reference/command/create/
The name of the collection to create要创建的集合的名称
Optional settings for the command命令的可选设置
Creates an index on the db and collection.在数据库和集合上创建索引。
Name of the collection to create the index on.要在其上创建索引的集合的名称。
Specify the field to index, or an index specification指定要索引的字段或索引规范
Drop a collection from the database, removing it permanently. 从数据库中删除集合,并将其永久删除。New accesses will create a new collection.新访问将创建新集合。
Name of collection to drop要删除的集合的名称
Drop a database, removing it permanently from the server.删除数据库,将其从服务器中永久删除。
Return the db logger返回数据库记录器
Retrieves this collections index info.检索此集合索引信息。
The name of the collection.集合的名称。
List all collections of this database with optional filter使用可选筛选器列出此数据库的所有集合
Query to filter collections by查询以筛选集合
Optional settings for the command命令的可选设置
Retrieve the current profiling Level for MongoDB检索MongoDB的当前分析级别
Remove a user from a database从数据库中删除用户
The username to remove要删除的用户名
Rename a collection.重命名集合。
Name of current collection to rename要重命名的当前集合的名称
New name of of the collection集合的新名称
Set the current profiling level of MongoDB设置MongoDB的当前分析级别
The new profiling level (off, slow_only, all).新的分析级别(off、slow_only、all)。
Get all the db statistics.获取所有数据库统计信息。
Unref all sockets取消引用所有套接字
Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this database. 创建一个新的更改流,监视此数据库中的新更改(插入、更新、替换、删除和无效)。Will ignore all changes to system collections.将忽略对系统集合的所有更改。
Type of the data being detected by the change stream更改流检测到的数据类型
Type of the whole change stream document emitted发出的整个变更流文档的类型
An array of aggregation pipeline stages through which to pass change stream documents. 一组聚合管道阶段,用于传递更改流文档。This allows for filtering (using $match) and manipulating the change stream documents.这允许筛选(使用$match
)和操作变更流文档。
Optional settings for the command命令的可选设置
Generated using TypeDoc
The Db class is a class that represents a MongoDB Database.Db类是表示MongoDB数据库的类。