Note
mongosh Methods方法
The methods listed on this table of contents page are 此目录页上列出的方法是mongosh methods. This is not the documentation for Node.js or other programming language specific driver methods.mongosh方法。这不是Node.js或其他特定于编程语言的驱动程序方法的文档。
In most cases, 在大多数情况下,mongosh methods work the same way as the legacy mongo shell methods. However, some legacy methods are unavailable in mongosh.mongosh方法的工作方式与遗留的mongoshell方法相同。然而,一些遗留方法在mongosh中不可用。
For MongoDB API drivers, refer to the language specific MongoDB driver documentation.有关MongoDB API驱动程序,请参阅特定语言的MongoDB驱动程序文档。
Note
For details on a specific method, including syntax and examples, click on the link to the method's reference page.有关特定方法的详细信息,包括语法和示例,请单击该方法参考页面的链接。
db.collection.analyzeShardKey() | |
db.collection.aggregate() | |
db.collection.bulkWrite() | |
db.collection.configureQueryAnalyzer() | |
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.size。将大小字段包裹在collStats的输出中。 |
db.collection.deleteOne() | |
db.collection.deleteMany() | |
db.collection.distinct() | |
db.collection.drop() | |
db.collection.dropIndex() | |
db.collection.dropIndexes() | |
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() |
Tip
To manage MongoDB Search indexes, see MongoDB Search and Vector Search Index Methods.要管理MongoDB搜索索引,请参阅MongoDB搜索和向量搜索索引方法。