Collection Methods集合方法
mongosh Methods
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 对于遗留的mongoshell文档,请参阅相应MongoDB Server版本的文档:mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:
For MongoDB API drivers, refer to the language specific MongoDB driver documentation.有关MongoDB API驱动程序,请参阅特定语言的MongoDB驱动程序文档。
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 .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() |