db.adminCommand() |
Runs a command against the admin database.对admin 数据库运行命令。 |
db.aggregate() |
Runs admin/diagnostic pipeline which does not require an underlying collection.运行不需要基础集合的管理/诊断管道。 |
db.cloneDatabase() |
Deprecated. 不赞成。Copies a database from a remote host to the current host when run against MongoDB 4.0 or earlier. 在MongoDB 4.0或更早版本上运行时,将数据库从远程主机复制到当前主机。Unsupported when run against MongoDB 4.2 or later.在MongoDB 4.2或更高版本上运行时不受支持。 |
db.commandHelp() |
Returns help information for a database command.返回数据库命令的帮助信息。 |
db.copyDatabase() |
Deprecated. 不赞成。Copies a database to another database on the current host when run against MongoDB 4.0 or earlier. 在MongoDB 4.0或更早版本上运行时,将数据库复制到当前主机上的另一个数据库。Unsupported when run against MongoDB 4.2 or later.在MongoDB 4.2或更高版本上运行时不受支持。 |
db.createCollection() |
Creates a new collection or a view. 创建新集合或视图。Commonly used to create a capped collection.通常用于创建封顶集合。 |
db.createView() |
Creates a view.创建一个视图。 |
db.currentOp() |
Reports the current in-progress operations.报告当前正在进行的操作。 |
db.dropDatabase() |
Removes the current database.删除当前数据库。 |
db.eval() |
Deprecated. 不赞成。Passes a JavaScript function for server-side JavaScript evaluation when run against MongoDB 4.0 or earlier. 在MongoDB 4.0或更早版本上运行时,传递用于服务器端JavaScript评估的JavaScript函数。Unsupported when run against MongoDB 4.2 or later.在MongoDB 4.2或更高版本上运行时不受支持。 |
db.fsyncLock() |
Flushes writes to disk and locks the database to prevent write operations and assist backup operations. 刷新对磁盘的写入并锁定数据库,以防止写入操作并协助备份操作。Wraps fsync .包装fsync 。 |
db.fsyncUnlock() |
Allows writes to continue on a database locked with db.fsyncLock() .允许在使用db.fsyncLock() 锁定的数据库上继续写入。 |
db.getCollection() |
Returns a collection or view object. 返回集合或视图对象。Used to access collections with names that are not valid in the mongo shell.用于访问名称在mongo shell中无效的集合。 |
db.getCollectionInfos() |
Returns collection information for all collections and views in the current database.返回当前数据库中所有集合和视图的集合信息。 |
db.getCollectionNames() |
Lists all collections and views in the current database.列出当前数据库中的所有集合和视图。 |
db.getLastError() |
Checks and returns the status of the last operation. 检查并返回上次操作的状态。Wraps getLastError .包装getLastError 。 |
db.getLastErrorObj() |
Returns the status document for the last operation. 返回上次操作的状态文档。Wraps getLastError .包装getLastError 。 |
db.getLogComponents() |
Returns the log message verbosity levels.返回日志消息的详细级别。 |
db.getMongo() |
Returns the Mongo() connection object for the current connection.返回当前连接的Mongo() 连接对象。 |
db.getName() |
Returns the name of the current database.返回当前数据库的名称。 |
db.getProfilingLevel() |
Returns the current profiling level for database operations.返回数据库操作的当前分析级别。 |
db.getProfilingStatus() |
Returns a document that reflects the current profiling level and the profiling threshold.返回反映当前分析级别和分析阈值的文档。 |
db.getReplicationInfo() |
Returns a document with replication statistics.返回包含复制统计信息的文档。 |
db.getSiblingDB() |
Provides access to the specified database.提供对指定数据库的访问。 |
db.help() |
Displays descriptions of common db object methods.显示常用db 对象方法的说明。 |
db.hostInfo() |
Returns a document with information about the system MongoDB runs on. 返回一个文档,其中包含有关MongoDB运行的系统的信息。Wraps hostInfo 包装hostInfo |
db.isMaster() |
Returns a document that reports the state of the replica set.返回报告副本集状态的文档。 |
db.killOp() |
Terminates a specified operation.终止指定的操作。 |
db.listCommands() |
Displays a list of common database commands.显示常用数据库命令的列表。 |
db.logout() |
Ends an authenticated session.结束经过身份验证的会话。 |
db.printCollectionStats() |
Prints statistics from every collection. 打印每个集合的统计信息。Wraps db.collection.stats() .包装db.collection.stats() 。 |
db.printReplicationInfo() |
Prints a report of the status of the replica set from the perspective of the primary.从主副本的角度打印副本集状态的报告。 |
db.printShardingStatus() |
Prints a report of the sharding configuration and the chunk ranges.打印分片配置和块范围的报告。 |
db.printSlaveReplicationInfo() |
Prints a report of the status of the replica set from the perspective of the secondaries.从二级副本的角度打印副本集状态的报告。 |
db.resetError() |
Deprecated. 不赞成。Resets the last error status.重置最后一个错误状态。 |
db.runCommand() |
Runs a database command.运行数据库命令。 |
db.serverBuildInfo() |
Returns a document that displays the compilation parameters for the mongod instance. 返回显示mongod 实例编译参数的文档。Wraps buildinfo .包装buildinfo 。 |
db.serverCmdLineOpts() |
Returns a document with information about the runtime used to start the MongoDB instance. 返回包含用于启动MongoDB实例的运行时信息的文档。Wraps getCmdLineOpts .包装getCmdLineOpts 。 |
db.serverStatus() |
Returns a document that provides an overview of the state of the database process.返回提供数据库进程状态概述的文档。 |
db.setLogLevel() |
Sets a single log message verbosity level.设置单个日志消息的详细级别。 |
db.setProfilingLevel() |
Modifies the current level of database profiling.修改数据库分析的当前级别。 |
db.shutdownServer() |
Shuts down the current mongod or mongos process cleanly and safely.干净安全地关闭当前mongod 或mongos 进程。 |
db.stats() |
Returns a document that reports on the state of the current database.返回报告当前数据库状态的文档。 |
db.version() |
Returns the version of the mongod instance.返回mongod 实例的版本。 |
db.watch() |
Opens a change stream cursor for a database to report on all its non-system collections. 打开数据库的更改流游标,以报告其所有非系统集合。Cannot be opened on the admin , local or config databases.无法在admin 、local 或config 数据库上打开。 |