The methods listed on this table of contents page are 目录页上列出的方法是mongosh
methods. mongosh
方法。 This is not the documentation for 这不是Node.js
or other programming language specific driver methods.Node.js
或其他编程语言特定驱动程序方法的文档。
In most cases, 在大多数情况下,mongosh
methods work the same way as the legacy mongo
shell methods. mongosh
方法的工作方式与传统mongo
Shell方法相同。However, some legacy methods are unavailable in 但是,一些传统方法在mongosh
.mongosh
中不可用。
For the legacy 有关传统mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:mongo
Shell文档,请参阅相应MongoDB服务器版本的文档:
For MongoDB API drivers, refer to the language specific MongoDB driver documentation.有关MongoDB API驱动程序,请参阅特定于语言的MongoDB驱动程序文档。
For details on specific methods, including syntax and examples, click on the specific method to go to its reference page.有关特定方法的详细信息,包括语法和示例,请单击特定方法以转到其参考页面。
db.collection.aggregate() | |
db.collection.bulkWrite() | |
db.collection.count() | count to return a count of the number of documents in a collection or a view.count 以返回集合或视图中文档数的计数。 |
db.collection.countDocuments() | $group aggregation stage with a $sum expression to return a count of the number of documents in a collection or a view.$sum 表达式包装$group 聚合阶段,以返回集合或视图中文档数的计数。
|
db.collection.createIndex() | |
db.collection.createIndexes() | |
db.collection.dataSize() | size field in the output of the collStats .collStats 的输出中包装size 字段。 |
db.collection.deleteOne() | |
db.collection.deleteMany() | |
db.collection.distinct() | |
db.collection.drop() | |
db.collection.dropIndex() | |
db.collection.dropIndexes() | |
db.collection.ensureIndex() | db.collection.createIndex() .db.collection.createIndex() 。 |
db.collection.estimatedDocumentCount() | count to return an approximate count of the documents in a collection or a view.count 以返回集合或视图中文档的近似计数。 |
db.collection.explain() | |
db.collection.find() | |
db.collection.findAndModify() | |
db.collection.findOne() | |
db.collection.findOneAndDelete() | |
db.collection.findOneAndReplace() | |
db.collection.findOneAndUpdate() | |
db.collection.getIndexes() | |
db.collection.getShardDistribution() | db.collection.getShardDistribution() reports data of chunk distribution.db.collection.getShardDistribution() 报告块分布的数据。 |
db.collection.getShardVersion() | |
db.collection.hideIndex() | |
db.collection.insertOne() | |
db.collection.insertMany() | |
db.collection.isCapped() | |
db.collection.latencyStats() | |
db.collection.mapReduce() | |
db.collection.reIndex() | |
db.collection.remove() | |
db.collection.renameCollection() | |
db.collection.replaceOne() | |
db.collection.stats() | collStats .collStats 的包装器。 |
db.collection.storageSize() | storageSize field of the collStats output.collStats 输出的storageSize 字段的包装器。 |
db.collection.totalIndexSize() | totalIndexSize field of the collStats output.collStats 输出的totalIndexSize 字段的包装器。 |
db.collection.totalSize() | |
db.collection.unhideIndex() | |
db.collection.updateOne() | |
db.collection.updateMany() | |
db.collection.watch() | |
db.collection.validate() |