├── can-kao ├── README.md ├── yun-suan-fu │ ├── README.md │ ├── query-and-projection-operators │ │ ├── ying-she-yun-suan-fu.md │ │ ├── element-query-operators.md │ │ ├── logical-query-operators │ │ │ ├── README.md │ │ │ ├── and.md │ │ │ ├── nor.md │ │ │ └── not.md │ │ ├── array-query-operators.md │ │ ├── comparison-query-operators │ │ │ ├── README.md │ │ │ ├── lt.md │ │ │ ├── lte.md │ │ │ ├── gte.md │ │ │ ├── ne.md │ │ │ ├── gt.md │ │ │ ├── nin.md │ │ │ └── in.md │ │ ├── bitwise-query-operators.md │ │ ├── evaluation-query-operators.md │ │ ├── comment.md │ │ └── geospatial-query-operators.md │ ├── update-operators │ │ ├── bitwise-update-operator.md │ │ ├── field-update-operators.md │ │ └── array-update-operators.md │ ├── aggregation-pipeline-operators │ │ ├── concat-aggregation.md │ │ ├── abs-aggregation.md │ │ ├── ceil-aggregation.md │ │ ├── cmp-aggregation.md │ │ └── concatarrays-aggregation.md │ └── query-modifiers.md ├── shu-ju-ku-ming-ling │ ├── README.md │ ├── ju-he-ming-ling.md │ ├── guan-li-ming-ling.md │ ├── ren-zheng-ming-ling.md │ ├── zhen-duan-ming-ling.md │ ├── geospatial-commands.md │ ├── system-events-auditing-commands.md │ ├── free-monitoring-commands.md │ ├── query-plan-cache-commands.md │ ├── user-management-commands.md │ ├── sessions-commands.md │ ├── query-and-write-operation-commands.md │ ├── role-management-commands.md │ └── replication-commands.md ├── mongo-shell-methods │ └── collection-methods │ │ ├── db-collection-getshardversion.md │ │ ├── db-collection-iscapped.md │ │ ├── db-collection-datasize.md │ │ ├── db-collection-totalindexsize.md │ │ ├── db-collection-storagesize.md │ │ ├── db-collection-totalsize.md │ │ ├── db-collection-ensureindex.md │ │ ├── db-collection-getindexes.md │ │ ├── db-collection-copyto.md │ │ ├── db-collection-reindex.md │ │ ├── db-collection-drop.md │ │ ├── db-collection-validate.md │ │ ├── db-collection-estimateddocumentcount.md │ │ └── db-collection-renamecollection.md └── default-mongodb-port.md ├── lian-xi-wo-men ├── README.md └── tapdata-cloud.md ├── cun-chu ├── cun-chu-yin-qing │ └── README.md └── journaling │ └── guan-li-ri-zhi-ji-lu │ └── README.md ├── docs ├── Reference │ ├── MongoDB-Package-Components │ │ ├── bsondump.md │ │ ├── mongo.md │ │ ├── mongod.md │ │ ├── mongos.md │ │ ├── mongotop.md │ │ ├── mongod.exe.md │ │ ├── mongodump.md │ │ ├── mongoexport.md │ │ ├── mongofiles.md │ │ ├── mongoimport.md │ │ ├── mongokerberos.md │ │ ├── mongoldap.md │ │ ├── mongoreplay.md │ │ ├── mongorestore.md │ │ ├── mongos.exe.md │ │ ├── mongostat.md │ │ └── install_compass.md │ ├── Operators │ │ ├── Aggregation-Pipeline-Operators │ │ │ ├── eq-aggregation.md │ │ │ ├── gt-aggregation.md │ │ │ ├── in-aggregation.md │ │ │ ├── ln-aggregation.md │ │ │ ├── lt-aggregation.md │ │ │ ├── ne-aggregation.md │ │ │ ├── or-aggregation.md │ │ │ ├── exp-aggregation.md │ │ │ ├── first-aggregation.md │ │ │ ├── floor-aggregation.md │ │ │ ├── gte-aggregation.md │ │ │ ├── hour-aggregation.md │ │ │ ├── last-aggregation.md │ │ │ ├── let-aggregation.md │ │ │ ├── log-aggregation.md │ │ │ ├── log10-aggregation.md │ │ │ ├── lte-aggregation.md │ │ │ ├── ltrim-aggregation.md │ │ │ ├── map-aggregation.md │ │ │ ├── max-aggregation.md │ │ │ ├── meta-aggregation.md │ │ │ ├── min-aggregation.md │ │ │ ├── mod-aggregation.md │ │ │ ├── month-aggregation.md │ │ │ ├── not-aggregation.md │ │ │ ├── pow-aggregation.md │ │ │ ├── push-aggregation.md │ │ │ ├── range-aggregation.md │ │ │ ├── round-aggregation.md │ │ │ ├── rtrim-aggregation.md │ │ │ ├── sin-aggregation.md │ │ │ ├── size-aggregation.md │ │ │ ├── slice-aggregation.md │ │ │ ├── split-aggregation.md │ │ │ ├── sqrt-aggregation.md │ │ │ ├── sum-aggregation.md │ │ │ ├── tan-aggregation.md │ │ │ ├── toInt-aggregation.md │ │ │ ├── trim-aggregation.md │ │ │ ├── trunc-aggregation.md │ │ │ ├── type-aggregation.md │ │ │ ├── week-aggregation.md │ │ │ ├── year-aggregation.md │ │ │ ├── divide-aggregation.md │ │ │ ├── filter-aggregation.md │ │ │ ├── ifNull-aggregation.md │ │ │ ├── isArray-aggregation.md │ │ │ ├── isoWeek-aggregation.md │ │ │ ├── minute-aggregation.md │ │ │ ├── reduce-aggregation.md │ │ │ ├── second-aggregation.md │ │ │ ├── substr-aggregation.md │ │ │ ├── switch-aggregation.md │ │ │ ├── toBool-aggregation.md │ │ │ ├── toDate-aggregation.md │ │ │ ├── toDouble(aggregation.md │ │ │ ├── toLong-aggregation.md │ │ │ ├── toLower-aggregation.md │ │ │ ├── toUpper-aggregation.md │ │ │ ├── dayOfMonth-aggregation.md │ │ │ ├── dayOfWeek-aggregation.md │ │ │ ├── dayOfYear-aggregation.md │ │ │ ├── indexOfCP-aggregation.md │ │ │ ├── multiply-aggregation.md │ │ │ ├── regexFind-aggregation.md │ │ │ ├── regexMatch-aggregation.md │ │ │ ├── setEquals-aggregation.md │ │ │ ├── setUnion-aggregation.md │ │ │ ├── stdDevPop-aggregation.md │ │ │ ├── stdDevSamp-aggregation.md │ │ │ ├── strLenCP-aggregation.md │ │ │ ├── strcasecmp-aggregation.md │ │ │ ├── substrCP-aggregation.md │ │ │ ├── subtract-aggregation.md │ │ │ ├── toDecimal-aggregation.md │ │ │ ├── toObjectId-aggregation.md │ │ │ ├── toString-aggregation.md │ │ │ ├── indexOfArray-aggregation.md │ │ │ ├── indexOfBytes-aggregation.md │ │ │ ├── isoDayOfWeek-aggregation.md │ │ │ ├── isoWeekYear-aggregation.md │ │ │ ├── mergeObjects-aggregation.md │ │ │ ├── millisecond-aggregation.md │ │ │ ├── regexFindAll-aggregation.md │ │ │ ├── reverseArray-aggregation.md │ │ │ ├── setIsSubset-aggregation.md │ │ │ ├── strLenBytes-aggregation.md │ │ │ ├── substrBytes-aggregation.md │ │ │ ├── objectToArray-aggregation.md │ │ │ ├── setDifference-aggregation.md │ │ │ ├── setIntersection-aggregation.md │ │ │ ├── degreesToRadians-aggregation.md │ │ │ ├── radiansToDegrees-aggregation.md │ │ │ ├── concat-aggregation.md │ │ │ ├── abs-aggregation.md │ │ │ ├── ceil-aggregation.md │ │ │ └── cmp-aggregation.md │ │ ├── Update-Operators │ │ │ ├── Bitwise-Update-Operator.md │ │ │ ├── Field-Update-Operators.md │ │ │ └── Array-Update-Operators.md │ │ └── Query-and-Projection-Operators │ │ │ ├── Element-Query-Operators.md │ │ │ ├── Logical-Query-Operators.md │ │ │ ├── Comparison-Query-Operators.md │ │ │ ├── Array-Query-Operators.md │ │ │ ├── Bitwise-Query-Operators.md │ │ │ ├── Evaluation-Query-Operators.md │ │ │ ├── Comparison-Query-Operators │ │ │ ├── lt.md │ │ │ ├── lte.md │ │ │ ├── gte.md │ │ │ ├── ne.md │ │ │ ├── gt.md │ │ │ ├── nin.md │ │ │ └── in.md │ │ │ ├── comment.md │ │ │ ├── Logical-Query-Operators │ │ │ ├── and.md │ │ │ ├── nor.md │ │ │ └── not.md │ │ │ └── Geospatial-Query-Operators.md │ ├── mongo-Shell-Methods │ │ └── Collection-Methods │ │ │ ├── db-collection-getShardVersion.md │ │ │ ├── db-collection-isCapped.md │ │ │ ├── db-collection-dataSize.md │ │ │ ├── db-collection-totalIndexSize.md │ │ │ ├── db-collection-storageSize.md │ │ │ ├── db-collection-totalSize.md │ │ │ ├── db-collection-ensureIndex.md │ │ │ ├── db-collection-getIndexes.md │ │ │ ├── db-collection-copyTo.md │ │ │ └── db-collection-reIndex.md │ ├── Database-Commands │ │ ├── System-Events-Auditing-Commands.md │ │ ├── Geospatial-Commands.md │ │ ├── Free-Monitoring-Commands.md │ │ ├── Authentication-Commands.md │ │ ├── Aggregation-Commands.md │ │ ├── Query-Plan-Cache-Commands.md │ │ ├── User-Management-Commands.md │ │ ├── Query-and-Write-Operation-Commands.md │ │ ├── Sessions-Commands.md │ │ ├── Role-Management-Commands.md │ │ └── Replication-Commands.md │ └── Default-MongoDB-Port.md ├── Mongo-Introduction │ └── Databases-and-Collections │ │ └── On-Demand-Materialized-Views.md ├── Security │ └── Appendix.md ├── MongoDB-CRUD-Operations │ ├── Text-Search │ │ ├── Text-Indexes.md │ │ └── Text-Search-Languages.md │ ├── MongoDB-CRUD-Concepts │ │ └── Tailable-Cursors.md │ ├── MongoDB-CRUD-Concepts.md │ └── Query-Documents │ │ └── Query-for-Null-or-Missing-Fields.md ├── Aggregation │ ├── Map-Reduce │ │ ├── Map-Reduce-Concurrency.md │ │ └── Map-Reduce-and-Sharded-Collections.md │ ├── Aggregation-Pipeline │ │ ├── Aggregation-Pipeline-and-Sharded-Collections.md │ │ └── Aggregation-Pipeline-Limits.md │ ├── Aggregation-Reference.md │ └── Aggregation-Reference │ │ ├── Aggregation-Commands.md │ │ └── Variables-in-Aggregation-Expressions.md ├── Install-MongoDB │ ├── Install-MongoDB-Community-Edition.md │ ├── Install-on-Linux-Enterprise.md │ ├── Install-on-Linux.md │ ├── Install-MongoDB-Enterprise.md │ └── Upgrade-MongoDB-Community-to-MongoDB-Enterprise.md ├── Indexes │ ├── Index-Properties.md │ ├── Indexing-Strategies.md │ ├── Indexing-Strategies │ │ └── Ensure-Indexes-Fit-in-RAM.md │ ├── geoHaystack-Indexes.md │ ├── geoHaystack-Indexes │ │ └── Query-a-Haystack-Index.md │ ├── 2d-Indexes │ │ └── Calculate-Distance-Using-Spherical-Geometry.md │ └── Text-Indexes │ │ ├── Control-Search-Results-with-Weights.md │ │ └── Limit-the-Number-of-Entries-Scanned.md └── Administration │ └── Configuration-and-Maintenance.md ├── fen-pian ├── zones │ ├── guan-li-fen-pian-qu-1.md │ ├── guan-li-fen-pian-qu.md │ ├── an-wei-zhi-xi-fen-shu-ju.md │ ├── an-ying-yong-huo-ke-hu-xi-fen-shu-ju.md │ ├── yong-yu-geng-gai-sla-huo-slo-de-fen-ceng-ying-jian.md │ └── jin-cha-ru-gong-zuo-fu-zai-de-fen-bu-shi-ben-di-xie-ru.md └── shi-yong-kuai-jin-hang-shu-ju-fen-qu │ └── README.md ├── guan-li └── shu-ju-zhong-xin-yi-shi │ ├── qu │ ├── README.md │ ├── guan-li-fen-pian-qu-1.md │ ├── guan-li-fen-pian-qu.md │ ├── an-wei-zhi-xi-fen-shu-ju.md │ ├── an-ying-yong-huo-ke-hu-xi-fen-shu-ju.md │ ├── yong-yu-geng-gai-sla-huo-slo-de-fen-ceng-ying-jian.md │ └── jin-cha-ru-gong-zuo-fu-zai-de-fen-bu-shi-ben-di-xie-ru.md │ ├── README.md │ └── mongodb-bu-shu-zhong-de-gong-zuo-fu-zai-ge-li.md ├── transactions ├── qu-dong-cheng-xu-api.md ├── sheng-chan-zhu-yi-shi-xiang.md └── sheng-chan-zhu-yi-shi-xiang-fen-pian-ji-qun.md ├── mongodb-crud-operations ├── mongodb-crud-concepts │ ├── query documents │ ├── yuan-zi-xing-he-shi-wu.md │ ├── tailable-cursors.md │ └── README.md ├── text-search │ ├── wen-ben-suo-yin.md │ └── text-search-languages.md ├── delete-documents │ └── delete-methods.md └── query-documents │ └── query-for-null-or-missing-fields.md ├── 404.html ├── img ├── logo │ ├── jinmu.png │ ├── MongoDB.png │ ├── jmlogo.png │ ├── MongoLogoBlack.png │ └── MongoDB-Community.png ├── pay │ ├── alipay.jpeg │ └── Wechatpay.jpeg └── docs │ └── Aggregation │ └── agg-pipeline.mp4 ├── .gitbook └── assets │ ├── jmlogo.png │ ├── mongodb.png │ ├── mongodb (1).png │ ├── MongoLogoBlack.png │ ├── mongoChina (1).png │ ├── mongoChina (1) (1).png │ ├── mongodb-community.png │ └── fan-yi-wen-dang-tu-pian-.png ├── security ├── appendix │ └── README.md └── authentication.md ├── Reference ├── Database-Commands │ ├── Authentication-Commands.md │ └── Aggregation-Commands.md └── README.md ├── src ├── init_gitbook.py └── script.py ├── aggregation ├── map-reduce │ ├── map-reduce-concurrency.md │ └── map-reduce-and-sharded-collections.md ├── aggregation-reference │ ├── README.md │ └── aggregation-commands.md └── aggregation-pipeline │ ├── aggregation-pipeline-and-sharded-collections.md │ └── aggregation-pipeline-limits.md ├── install-mongodb ├── install-mongodb-community-edition │ ├── README.md │ └── install-on-linux.md ├── install-mongodb-enterprise │ ├── install-on-linux-enterprise.md │ └── README.md └── upgrade-mongodb-community-to-mongodb-enterprise.md ├── indexes ├── index-properties │ └── README.md ├── indexing-strategies │ ├── README.md │ └── ensure-indexes-fit-in-ram.md ├── geohaystack-indexes │ ├── README.md │ └── query-a-haystack-index.md ├── 2d-indexes │ └── calculate-distance-using-spherical-geometry.md └── text-indexes │ ├── limit-the-number-of-entries-scanned.md │ └── control-search-results-with-weights.md ├── mongodb-versioning.md ├── run_website.sh ├── shu-ju-mo-xing └── README.md └── faq └── README.md /can-kao/README.md: -------------------------------------------------------------------------------- 1 | # MongoDB参考 2 | 3 | -------------------------------------------------------------------------------- /lian-xi-wo-men/README.md: -------------------------------------------------------------------------------- 1 | # 联系我们 2 | 3 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/README.md: -------------------------------------------------------------------------------- 1 | # 运算符 2 | 3 | -------------------------------------------------------------------------------- /cun-chu/cun-chu-yin-qing/README.md: -------------------------------------------------------------------------------- 1 | # 存储引擎 2 | 3 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/bsondump.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongo.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongod.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongos.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongotop.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/README.md: -------------------------------------------------------------------------------- 1 | # 数据库命令 2 | 3 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongod.exe.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongodump.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongoexport.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongofiles.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongoimport.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongokerberos.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongoldap.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongoreplay.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongorestore.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongos.exe.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/mongostat.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fen-pian/zones/guan-li-fen-pian-qu-1.md: -------------------------------------------------------------------------------- 1 | # 管理分片区 2 | 3 | -------------------------------------------------------------------------------- /fen-pian/zones/guan-li-fen-pian-qu.md: -------------------------------------------------------------------------------- 1 | # 管理分片区 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/README.md: -------------------------------------------------------------------------------- 1 | # 区 2 | 3 | -------------------------------------------------------------------------------- /transactions/qu-dong-cheng-xu-api.md: -------------------------------------------------------------------------------- 1 | # 驱动程序 API 2 | 3 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/ju-he-ming-ling.md: -------------------------------------------------------------------------------- 1 | # 聚合命令 2 | 3 | -------------------------------------------------------------------------------- /docs/Reference/MongoDB-Package-Components/install_compass.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fen-pian/zones/an-wei-zhi-xi-fen-shu-ju.md: -------------------------------------------------------------------------------- 1 | # 按位置细分数据 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/README.md: -------------------------------------------------------------------------------- 1 | # 数据中心意识 2 | 3 | -------------------------------------------------------------------------------- /transactions/sheng-chan-zhu-yi-shi-xiang.md: -------------------------------------------------------------------------------- 1 | # 生产注意事项 2 | 3 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/guan-li-ming-ling.md: -------------------------------------------------------------------------------- 1 | # 管理命令 2 | 3 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/ren-zheng-ming-ling.md: -------------------------------------------------------------------------------- 1 | # 认证命令 2 | 3 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/zhen-duan-ming-ling.md: -------------------------------------------------------------------------------- 1 | # 诊断命令 2 | 3 | -------------------------------------------------------------------------------- /cun-chu/journaling/guan-li-ri-zhi-ji-lu/README.md: -------------------------------------------------------------------------------- 1 | # 管理日志记录 2 | 3 | -------------------------------------------------------------------------------- /mongodb-crud-operations/mongodb-crud-concepts/query documents: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mongodb-crud-operations/text-search/wen-ben-suo-yin.md: -------------------------------------------------------------------------------- 1 | # 文本索引 2 | 3 | -------------------------------------------------------------------------------- /fen-pian/shi-yong-kuai-jin-hang-shu-ju-fen-qu/README.md: -------------------------------------------------------------------------------- 1 | # 使用块进行数据分区 2 | 3 | -------------------------------------------------------------------------------- /fen-pian/zones/an-ying-yong-huo-ke-hu-xi-fen-shu-ju.md: -------------------------------------------------------------------------------- 1 | # 按应用或客户细分数据 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/guan-li-fen-pian-qu-1.md: -------------------------------------------------------------------------------- 1 | # 管理分片区 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/guan-li-fen-pian-qu.md: -------------------------------------------------------------------------------- 1 | # 管理分片区 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/an-wei-zhi-xi-fen-shu-ju.md: -------------------------------------------------------------------------------- 1 | # 按位置细分数据 2 | 3 | -------------------------------------------------------------------------------- /transactions/sheng-chan-zhu-yi-shi-xiang-fen-pian-ji-qun.md: -------------------------------------------------------------------------------- 1 | # 生产注意事项 \(分片集群\) 2 | 3 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/ying-she-yun-suan-fu.md: -------------------------------------------------------------------------------- 1 | # 映射运算符 2 | 3 | -------------------------------------------------------------------------------- /mongodb-crud-operations/mongodb-crud-concepts/yuan-zi-xing-he-shi-wu.md: -------------------------------------------------------------------------------- 1 | # 原子性和事务 2 | 3 | -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /404.html 3 | --- 4 | 5 | -------------------------------------------------------------------------------- /fen-pian/zones/yong-yu-geng-gai-sla-huo-slo-de-fen-ceng-ying-jian.md: -------------------------------------------------------------------------------- 1 | # 用于更改SLA或SLO的分层硬件 2 | 3 | -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/an-ying-yong-huo-ke-hu-xi-fen-shu-ju.md: -------------------------------------------------------------------------------- 1 | # 按应用或客户细分数据 2 | 3 | -------------------------------------------------------------------------------- /fen-pian/zones/jin-cha-ru-gong-zuo-fu-zai-de-fen-bu-shi-ben-di-xie-ru.md: -------------------------------------------------------------------------------- 1 | # 仅插入工作负载的分布式本地写入 2 | 3 | -------------------------------------------------------------------------------- /img/logo/jinmu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/logo/jinmu.png -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/eq-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$eq (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/gt-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$gt (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/in-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$in (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/ln-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ln (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/lt-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$lt (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/ne-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ne (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/or-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$or (aggregation) 2 | []() -------------------------------------------------------------------------------- /img/logo/MongoDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/logo/MongoDB.png -------------------------------------------------------------------------------- /img/logo/jmlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/logo/jmlogo.png -------------------------------------------------------------------------------- /img/pay/alipay.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/pay/alipay.jpeg -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/exp-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$exp (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/first-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$first (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/floor-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$floor (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/gte-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$gte (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/hour-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$hour (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/last-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$last (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/let-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$let (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/log-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$log (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/log10-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$log10 (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/lte-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$lte (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/ltrim-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ltrim (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/map-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$map (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/max-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$max (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/meta-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$meta (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/min-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$min (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/mod-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$mod (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/month-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$month (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/not-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$not (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/pow-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$pow (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/push-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$push (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/range-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$range (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/round-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$round (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/rtrim-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$rtrim (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/sin-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$sin (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/size-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$size (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/slice-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$slice (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/split-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$split (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/sqrt-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$sqrt (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/sum-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$sum (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/tan-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$tan (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toInt-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toInt (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/trim-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$trim (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/trunc-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$trunc (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/type-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$type (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/week-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$week (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/year-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$year (aggregation) 2 | []() -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/mongodb-bu-shu-zhong-de-gong-zuo-fu-zai-ge-li.md: -------------------------------------------------------------------------------- 1 | # MongoDB部署中的工作负载隔离 2 | 3 | -------------------------------------------------------------------------------- /img/pay/Wechatpay.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/pay/Wechatpay.jpeg -------------------------------------------------------------------------------- /docs/Mongo-Introduction/Databases-and-Collections/On-Demand-Materialized-Views.md: -------------------------------------------------------------------------------- 1 | On-Demand-Materialized-Views 未汉化 -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/divide-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$divide (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/filter-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$filter (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/ifNull-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ifNull (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/isArray-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$isArray (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/isoWeek-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$isoWeek (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/minute-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$minute (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/reduce-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$reduce (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/second-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$second (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/substr-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$substr (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/switch-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$switch (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toBool-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toBool (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toDate-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toDate (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toDouble(aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toDouble(aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toLong-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toLong (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toLower-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toLower (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toUpper-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toUpper (aggregation) 2 | []() -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/yong-yu-geng-gai-sla-huo-slo-de-fen-ceng-ying-jian.md: -------------------------------------------------------------------------------- 1 | # 用于更改SLA或SLO的分层硬件 2 | 3 | -------------------------------------------------------------------------------- /.gitbook/assets/jmlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/jmlogo.png -------------------------------------------------------------------------------- /.gitbook/assets/mongodb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/mongodb.png -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/dayOfMonth-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$dayOfMonth (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/dayOfWeek-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$dayOfWeek (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/dayOfYear-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$dayOfYear (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/indexOfCP-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$indexOfCP (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/multiply-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$multiply (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/regexFind-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$regexFind (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/regexMatch-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$regexMatch (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/setEquals-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$setEquals (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/setUnion-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$setUnion (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/stdDevPop-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$stdDevPop (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/stdDevSamp-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$stdDevSamp (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/strLenCP-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$strLenCP (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/strcasecmp-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$strcasecmp (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/substrCP-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$substrCP (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/subtract-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$subtract (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toDecimal-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toDecimal (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toObjectId-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toObjectId (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/toString-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$toString (aggregation) 2 | []() -------------------------------------------------------------------------------- /guan-li/shu-ju-zhong-xin-yi-shi/qu/jin-cha-ru-gong-zuo-fu-zai-de-fen-bu-shi-ben-di-xie-ru.md: -------------------------------------------------------------------------------- 1 | # 仅插入工作负载的分布式本地写入 2 | 3 | -------------------------------------------------------------------------------- /img/logo/MongoLogoBlack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/logo/MongoLogoBlack.png -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/indexOfArray-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$indexOfArray (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/indexOfBytes-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$indexOfBytes (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/isoDayOfWeek-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$isoDayOfWeek (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/isoWeekYear-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$isoWeekYear (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/mergeObjects-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$mergeObjects (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/millisecond-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$millisecond (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/regexFindAll-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$regexFindAll (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/reverseArray-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$reverseArray (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/setIsSubset-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$setIsSubset (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/strLenBytes-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$strLenBytes (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/substrBytes-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$substrBytes (aggregation) 2 | []() -------------------------------------------------------------------------------- /img/logo/MongoDB-Community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/logo/MongoDB-Community.png -------------------------------------------------------------------------------- /.gitbook/assets/mongodb (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/mongodb (1).png -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/objectToArray-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$objectToArray (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/setDifference-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$setDifference (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/setIntersection-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$setIntersection (aggregation) 2 | []() -------------------------------------------------------------------------------- /.gitbook/assets/MongoLogoBlack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/MongoLogoBlack.png -------------------------------------------------------------------------------- /.gitbook/assets/mongoChina (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/mongoChina (1).png -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/degreesToRadians-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$degreesToRadians (aggregation) 2 | []() -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/radiansToDegrees-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$radiansToDegrees (aggregation) 2 | []() -------------------------------------------------------------------------------- /.gitbook/assets/mongoChina (1) (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/mongoChina (1) (1).png -------------------------------------------------------------------------------- /.gitbook/assets/mongodb-community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/mongodb-community.png -------------------------------------------------------------------------------- /img/docs/Aggregation/agg-pipeline.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/img/docs/Aggregation/agg-pipeline.mp4 -------------------------------------------------------------------------------- /.gitbook/assets/fan-yi-wen-dang-tu-pian-.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-china/MongoDB-CN-Manual/HEAD/.gitbook/assets/fan-yi-wen-dang-tu-pian-.png -------------------------------------------------------------------------------- /lian-xi-wo-men/tapdata-cloud.md: -------------------------------------------------------------------------------- 1 | # Tapdata Cloud 2 | 3 | Tapdata Cloud 是基于 MongoDB 建立数据同步工具,支持多源异构数据实时同步。 4 | 5 | 详情访问:[cloud.tapdata.net](https://cloud.tapdata.net/) 6 | 7 | -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-getshardversion.md: -------------------------------------------------------------------------------- 1 | # db.collection.getShardVersion\(\) 2 | 3 | * `db.collection.` `getShardVersion` \(\) 4 | * 此方法返回有关分片集群中数据的 state 的信息,该信息在诊断分片 cluster 的基础问题时很有用。 5 | 6 | 仅供内部和诊断使用。 7 | 8 | 译者:李冠飞 9 | 10 | 校对: 11 | 12 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/geospatial-commands.md: -------------------------------------------------------------------------------- 1 | # 地理空间命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`geoSearch`](geospatial-commands.md) | 执行使用MongoDB的haystack索引功能的地理空间查询。 | 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/update-operators/bitwise-update-operator.md: -------------------------------------------------------------------------------- 1 | # 按位更新运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$bit`](bitwise-update-operator.md) | 执行按位`AND`,`OR`和`XOR`整数值的更新。 | 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-iscapped.md: -------------------------------------------------------------------------------- 1 | # db.collection.isCapped\(\) 2 | 3 | * `db.collection.` `isCapped` \(\) 4 | 5 | | | | 6 | | :--- | :--- | 7 | | 返回: | 如果集合是上限集合则返回`true`,否则返回`false`。 | 8 | 9 | > **也可以看看** 10 | > 11 | > 上限集合 12 | 13 | 译者:李冠飞 14 | 15 | 校对: 16 | 17 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/system-events-auditing-commands.md: -------------------------------------------------------------------------------- 1 | # 系统事件审计命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`logApplicationMessage`](system-events-auditing-commands.md) | 将自定义消息发布到审核日志。 | 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-datasize.md: -------------------------------------------------------------------------------- 1 | # db.collection.dataSize\(\) 2 | 3 | * `db.collection.dataSize()` 4 | 5 | | | | 6 | | :--- | :--- | 7 | | 返回: | 集合的大小\(以字节为单位\)。 数据压缩不会影响此 value。 | 8 | 9 | 此方法在collStats\(即:db.collection.stats\(\)\)命令的尺寸输出周围提供 wrapper。 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-getShardVersion.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.getShardVersion() 2 | 3 | []() 4 | 5 | 6 | 7 | * `db.collection.` `getShardVersion` () 8 | 9 | * 此方法返回有关分片集群中数据的 state 的信息,该信息在诊断分片 cluster 的基础问题时很有用。 10 | 11 | 仅供内部和诊断使用。 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/element-query-operators.md: -------------------------------------------------------------------------------- 1 | # 元素查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$exists`](element-query-operators.md) | 匹配具有指定字段的文档。 | 10 | | [`$type`](element-query-operators.md) | 如果字段是指定类型,则选择文档。 | 11 | 12 | 译者:李冠飞 13 | 14 | 校对: 15 | 16 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/free-monitoring-commands.md: -------------------------------------------------------------------------------- 1 | # 免费监控命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`getFreeMonitoringStatus`](free-monitoring-commands.md) | 返回空闲监视状态。 | 10 | | [`setFreeMonitoring`](free-monitoring-commands.md) | 在运行时启用/禁用免费监视。 | 11 | 12 | 译者:李冠飞 13 | 14 | 校对: 15 | 16 | -------------------------------------------------------------------------------- /docs/Security/Appendix.md: -------------------------------------------------------------------------------- 1 | # 附录 2 | 3 | 4 | - [附录A-用于测试的 OpenSSL CA 证书](https://docs.mongodb.com/manual/appendix/security/appendixA-openssl-ca/) 5 | - [附录B-用于测试的 OpenSSL 服务器证书](https://docs.mongodb.com/manual/appendix/security/appendixB-openssl-server/) 6 | - [附录C-用于测试的 OpenSSL 客户端证书](https://docs.mongodb.com/manual/appendix/security/appendixC-openssl-client/) 7 | 8 | 译者:谢伟成 9 | -------------------------------------------------------------------------------- /security/appendix/README.md: -------------------------------------------------------------------------------- 1 | # 附录 2 | 3 | * [附录A-用于测试的 OpenSSL CA 证书](https://docs.mongodb.com/manual/appendix/security/appendixA-openssl-ca/) 4 | * [附录B-用于测试的 OpenSSL 服务器证书](https://docs.mongodb.com/manual/appendix/security/appendixB-openssl-server/) 5 | * [附录C-用于测试的 OpenSSL 客户端证书](https://docs.mongodb.com/manual/appendix/security/appendixC-openssl-client/) 6 | 7 | 译者:谢伟成 8 | 9 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Update-Operators/Bitwise-Update-Operator.md: -------------------------------------------------------------------------------- 1 | # [ ](#)按位更新运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ---------- | ---------------------------------------- | 11 | | [`$bit`]() | 执行按位`AND`,`OR`和`XOR`整数值的更新。 | 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-totalindexsize.md: -------------------------------------------------------------------------------- 1 | # db.collection.totalIndexSize\(\) 2 | 3 | * `db.collection.` `totalIndexSize` \(\) 4 | 5 | | | | 6 | | :--- | :--- | 7 | | 返回: | 集合的所有索引的总大小。 如果索引使用前缀压缩\(即WiredTiger 的默认值\),则返回的大小反映压缩大小。 | 8 | 9 | 此方法在collStats\(即:db.collection.stats\(\)\)操作的totalIndexSize输出周围提供包装。 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/System-Events-Auditing-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)数据库命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | --------------------------- | ---------------------------- | 11 | | [`logApplicationMessage`]() | 将自定义消息发布到审核日志。 | 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Geospatial-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)地理空间命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | --------------- | ------------------------------------------------- | 11 | | [`geoSearch`]() | 执行使用MongoDB的haystack索引功能的地理空间查询。 | 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Element-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)元素查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ------------- | -------------------------------- | 11 | | [`$exists`]() | 匹配具有指定字段的文档。 | 12 | | [`$type`]() | 如果字段是指定类型,则选择文档。 | 13 | 14 | 15 | 16 | 译者:李冠飞 17 | 18 | 校对: -------------------------------------------------------------------------------- /Reference/Database-Commands/Authentication-Commands.md: -------------------------------------------------------------------------------- 1 | # 认证命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`authenticate`](authentication-commands.md) | 使用用户名和密码启动经过身份验证的会话。 | 10 | | [`getnonce`](authentication-commands.md) | 这是一个内部命令,用于生成用于身份验证的一次性密码。 | 11 | | [`logout`](authentication-commands.md) | 终止当前已认证的会话。 | 12 | 13 | 译者:李冠飞 14 | 15 | 校对: 16 | 17 | -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-storagesize.md: -------------------------------------------------------------------------------- 1 | # db.collection.storageSize\(\) 2 | 3 | * `db.collection.` `storageSize` \(\) 4 | 5 | | | | 6 | | :--- | :--- | 7 | | 返回: | 分配给此集合以进行文档存储的总存储量。 如果压缩了集合数据\(即WiredTiger 的默认值\),则存储大小反映压缩大小,可能小于db.collection.dataSize\(\)返回的 value。 | 8 | 9 | 在collStats\(即:db.collection.stats\(\)\)输出的storageSize字段周围提供 wrapper。 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-isCapped.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.isCapped() 2 | 3 | []() 4 | 5 | 6 | * `db.collection.` `isCapped` () 7 | 8 | |
| | 9 | | ------ | ------------------------------------------------- | 10 | | 返回: | 如果集合是上限集合则返回`true`,否则返回`false`。 | 11 | 12 | > **也可以看看** 13 | > 14 | > 上限集合 15 | 16 | 17 | 18 | 译者:李冠飞 19 | 20 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Free-Monitoring-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)免费监控命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ----------------------------- | --------------------------- | 11 | | [`getFreeMonitoringStatus`]() | 返回空闲监视状态。 | 12 | | [`setFreeMonitoring`]() | 在运行时启用/禁用免费监视。 | 13 | 14 | 15 | 16 | 译者:李冠飞 17 | 18 | 校对: -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-totalsize.md: -------------------------------------------------------------------------------- 1 | # db.collection.totalSize\(\) 2 | 3 | * `db.collection.` `totalSize` \(\) 4 | 5 | | | | 6 | | :--- | :--- | 7 | | 返回: | 集合中数据的总大小\(以字节为单位\)加上集合中每个索引的大小。 如果压缩了集合数据\(即WiredTiger 的默认值\),则返回的大小反映了集合数据的压缩大小。 如果索引使用前缀压缩\(即WiredTiger 的默认值\),则返回的大小反映索引的压缩大小。 | 8 | 9 | 返回的 value 是db.collection.storageSize\(\)和db.collection.totalIndexSize\(\)的总和\(以字节为单位\)。 10 | 11 | 译者:李冠飞 12 | 13 | 校对: 14 | 15 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/logical-query-operators/README.md: -------------------------------------------------------------------------------- 1 | # 逻辑查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$and`](./) | 使用逻辑`AND`连接查询子句,返回与这两个子句条件匹配的所有文档。 | 10 | | [`$not`](./) | 反转查询表达式的效果,并返回与查询表达式_不_匹配的文档。 | 11 | | [`$nor`](./) | 用逻辑`NOR`连接查询子句,返回所有不能匹配这两个子句的文档。 | 12 | | [`$or`](./) | 用逻辑`OR`连接查询子句,返回与任一子句条件匹配的所有文档。 | 13 | 14 | 译者:李冠飞 15 | 16 | 校对: 17 | 18 | -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-dataSize.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.dataSize() 2 | 3 | []() 4 | 5 | * `db.collection.dataSize()` 6 | 7 | 8 | |
| | 9 | | ------ | ----------------------------------------------------- | 10 | | 返回: | 集合的大小(以字节为单位)。 数据压缩不会影响此 value。 | 11 | 12 | 13 | 此方法在collStats(即:db.collection.stats())命令的尺寸输出周围提供 wrapper。 14 | 15 | 16 | 17 | 译者:李冠飞 18 | 19 | 校对: -------------------------------------------------------------------------------- /src/init_gitbook.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | import os 3 | import sys 4 | import shutil 5 | 6 | 7 | def init_data(versions): 8 | vs = versions.split(" ") 9 | for v in vs: 10 | src = "node_modules" 11 | dst = "docs/%s/node_modules" % v 12 | if not os.path.exists(dst): 13 | shutil.copytree(src, dst) 14 | 15 | 16 | if __name__ == "__main__": 17 | versions = sys.argv[1] 18 | 19 | # 初始化 gitbook 数据文件的复制 20 | init_data(versions) 21 | -------------------------------------------------------------------------------- /Reference/Database-Commands/Aggregation-Commands.md: -------------------------------------------------------------------------------- 1 | # 聚合命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`aggregate`](aggregation-commands.md) | 使用聚合框架执行聚合任务,例如分组。 | 10 | | [`count`](aggregation-commands.md) | 计算集合或视图中的文档数。 | 11 | | [`distinct`](aggregation-commands.md) | 显示在集合或视图中为指定键找到的不同值。 | 12 | | [`mapReduce`](aggregation-commands.md) | 对大型数据集执行map-reduce聚合。 | 13 | 14 | 有关不同方法的详细比较,请参阅“ 聚合命令比较”。 15 | 16 | 译者:李冠飞 17 | 18 | 校对: 19 | 20 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/array-query-operators.md: -------------------------------------------------------------------------------- 1 | # 数组查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$all`](array-query-operators.md) | 匹配包含查询中指定的所有元素的数组。 | 10 | | [`$elemMatch`](array-query-operators.md) | 如果array字段中的元素符合所有指定`$elemMatch`条件,则选择文档。 | 11 | | [`$size`](array-query-operators.md) | 如果数组字段为指定大小,则选择文档。 | 12 | 13 | 有关查询数组字段的示例,请参见: 14 | 15 | * 查询数组 16 | * 查询嵌入式文档数组 17 | 18 | 译者:李冠飞 19 | 20 | 校对: 21 | 22 | -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-totalIndexSize.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.totalIndexSize() 2 | 3 | []() 4 | 5 | * `db.collection.` `totalIndexSize` () 6 | 7 | |
| | 8 | | ------ | ------------------------------------------------------------ | 9 | | 返回: | 集合的所有索引的总大小。
如果索引使用前缀压缩(即WiredTiger 的默认值),则返回的大小反映压缩大小。 | 10 | 11 | 此方法在collStats(即:db.collection.stats())操作的totalIndexSize输出周围提供包装。 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Authentication-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)认证命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ------------------ | ---------------------------------------------------- | 11 | | [`authenticate`]() | 使用用户名和密码启动经过身份验证的会话。 | 12 | | [`getnonce`]() | 这是一个内部命令,用于生成用于身份验证的一次性密码。 | 13 | | [`logout`]() | 终止当前已认证的会话。 | 14 | 15 | 16 | 17 | 译者:李冠飞 18 | 19 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Aggregation-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)聚合命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | --------------- | ---------------------------------------- | 11 | | [`aggregate`]() | 使用聚合框架执行聚合任务,例如分组。 | 12 | | [`count`]() | 计算集合或视图中的文档数。 | 13 | | [`distinct`]() | 显示在集合或视图中为指定键找到的不同值。 | 14 | | [`mapReduce`]() | 对大型数据集执行map-reduce聚合。 | 15 | 16 | 有关不同方法的详细比较,请参阅“ 聚合命令比较”。 17 | 18 | 19 | 20 | 译者:李冠飞 21 | 22 | 校对: -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-storageSize.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.storageSize() 2 | 3 | []() 4 | 5 | * `db.collection.` `storageSize` () 6 | 7 | |
| | 8 | | ------ | ------------------------------------------------------------ | 9 | | 返回: | 分配给此集合以进行文档存储的总存储量。
如果压缩了集合数据(即WiredTiger 的默认值),则存储大小反映压缩大小,可能小于db.collection.dataSize()返回的 value。 | 10 | 11 | 在collStats(即:db.collection.stats())输出的storageSize字段周围提供 wrapper。 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/README.md: -------------------------------------------------------------------------------- 1 | # 比较查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 8 | 9 | | 名称 | 结果 | 10 | | :--- | :--- | 11 | | [`$eq`](./) | 匹配等于指定值的值。 | 12 | | [`$gt`](./) | 匹配大于指定值的值。 | 13 | | [`$gte`](./) | 匹配大于或等于指定值的值。 | 14 | | [`$in`](./) | 匹配数组中指定的任何值。 | 15 | | [`$lt`](./) | 匹配小于指定值的值。 | 16 | | [`$lte`](./) | 匹配小于或等于指定值的值。 | 17 | | [`$ne`](./) | 匹配所有不等于指定值的值。 | 18 | | [`$nin`](./) | 不匹配数组中指定的任何值。 | 19 | 20 | 译者:李冠飞 21 | 22 | 校对: 23 | 24 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/bitwise-query-operators.md: -------------------------------------------------------------------------------- 1 | # 按位查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$bitsAllClear`](bitwise-query-operators.md) | 匹配数字或二进制值,其中一组位的_所有_值均为`0`。 | 10 | | [`$bitsAllSet`](bitwise-query-operators.md) | 匹配数字或二进制值,其中一组位的_所有_值均为`1`。 | 11 | | [`$bitsAnyClear`](bitwise-query-operators.md) | 匹配数值或二进制值,在这些数值或二进制值中,一组位的位置中_任何_位的值为`0`。 | 12 | | [`$bitsAnySet`](bitwise-query-operators.md) | 匹配数值或二进制值,在这些数值或二进制值中,一组位的位置中_任何_位的值为`1`。 | 13 | 14 | 译者:李冠飞 15 | 16 | 校对: 17 | 18 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Logical-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)逻辑查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ---------- | ------------------------------------------------------------ | 11 | | [`$and`]() | 使用逻辑`AND`连接查询子句,返回与这两个子句条件匹配的所有文档。 | 12 | | [`$not`]() | 反转查询表达式的效果,并返回与查询表达式*不*匹配的文档。 | 13 | | [`$nor`]() | 用逻辑`NOR`连接查询子句,返回所有不能匹配这两个子句的文档。 | 14 | | [`$or`]() | 用逻辑`OR`连接查询子句,返回与任一子句条件匹配的所有文档。 | 15 | 16 | 17 | 18 | 译者:李冠飞 19 | 20 | 校对: -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-totalSize.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.totalSize() 2 | 3 | []() 4 | 5 | * `db.collection.` `totalSize` () 6 | 7 | |
| | 8 | | ------ | ------------------------------------------------------------ | 9 | | 返回: | 集合中数据的总大小(以字节为单位)加上集合中每个索引的大小。
如果压缩了集合数据(即WiredTiger 的默认值),则返回的大小反映了集合数据的压缩大小。
如果索引使用前缀压缩(即WiredTiger 的默认值),则返回的大小反映索引的压缩大小。 | 10 | 11 | 返回的 value 是db.collection.storageSize()和db.collection.totalIndexSize()的总和(以字节为单位)。 12 | 13 | 14 | 15 | 译者:李冠飞 16 | 17 | 校对: -------------------------------------------------------------------------------- /docs/MongoDB-CRUD-Operations/Text-Search/Text-Indexes.md: -------------------------------------------------------------------------------- 1 | # 文本索引 2 | MongoDB提供了[文本索引](https://docs.mongodb.com/master/core/index-text/#index-feature-text)来支持对字符串内容的文本搜索查询。`text`索引可以包含值为字符串或字符串元素数组的任何字段。 3 | 4 | 要执行文本搜索查询,您必须在集合上有一个**text**索引。一个集合只能有一个文本搜索索引,但是该索引可以覆盖多个字段。 5 | 6 | 例如,你可以运行以下在一个m[`mongo`](https://docs.mongodb.com/master/reference/program/mongo/#bin.mongo) shell允许文本搜索的名称和描述字段: 7 | 8 | ```shell 9 | db.stores.createIndex( { name: "text", description: "text" } ) 10 | ``` 11 | 12 | 有关文本索引的完整引用,包括行为、标记和属性,请参阅[Text Indexes](https://docs.mongodb.com/manual/core/index-text/)部分。 13 | 14 | 15 | 16 | 译者:杨帅 17 | 18 | 校对:杨帅 -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)比较查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 10 | 11 | | 名称 | 结果 | 12 | | ---------- | -------------------------- | 13 | | [`$eq`]() | 匹配等于指定值的值。 | 14 | | [`$gt`]() | 匹配大于指定值的值。 | 15 | | [`$gte`]() | 匹配大于或等于指定值的值。 | 16 | | [`$in`]() | 匹配数组中指定的任何值。 | 17 | | [`$lt`]() | 匹配小于指定值的值。 | 18 | | [`$lte`]() | 匹配小于或等于指定值的值。 | 19 | | [`$ne`]() | 匹配所有不等于指定值的值。 | 20 | | [`$nin`]() | 不匹配数组中指定的任何值。 | 21 | 22 | 23 | 24 | 译者:李冠飞 25 | 26 | 校对: -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-ensureindex.md: -------------------------------------------------------------------------------- 1 | # db.collection.ensureIndex\(\) 2 | 3 | 在本页面 4 | 5 | * [定义](db-collection-ensureindex.md#definition) 6 | * [附加信息](db-collection-ensureindex.md#additional-information) 7 | 8 | ## 定义 9 | 10 | * `db.collection.` `ensureIndex`\(键,选项\) 11 | * _从3.0.0版开始不推荐使用:_`db.collection.ensureIndex()`现在是的别名 `db.collection.createIndex()`。 12 | 13 | 如果索引尚不存在,则在指定字段上创建索引。 14 | 15 | ## 附加信息 16 | 17 | * 使用db.collection.createIndex\(\)而不是db.collection.ensureIndex\(\)来创建新索引。 18 | * 本手册的索引部分用于 MongoDB 中索引和索引的完整文档。 19 | * db.collection.getIndexes\(\)查看集合的现有索引的规范。 20 | 21 | 译者:李冠飞 22 | 23 | 校对: 24 | 25 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/evaluation-query-operators.md: -------------------------------------------------------------------------------- 1 | # 评估查询运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$expr`](evaluation-query-operators.md) | 允许在查询语言中使用聚合表达式。 | 10 | | [`$jsonSchema`](evaluation-query-operators.md) | 根据给定的JSON Schema验证文档。 | 11 | | [`$mod`](evaluation-query-operators.md) | 对字段的值执行模运算并选择具有指定结果的文档。 | 12 | | [`$regex`](evaluation-query-operators.md) | 选择值与指定的正则表达式匹配的文档。 | 13 | | [`$text`](evaluation-query-operators.md) | 执行文本搜索。 | 14 | | [`$where`](evaluation-query-operators.md) | 匹配满足JavaScript表达式的文档。 | 15 | 16 | 译者:李冠飞 17 | 18 | 校对: 19 | 20 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Array-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)数组查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ---------------- | ------------------------------------------------------------ | 11 | | [`$all`]() | 匹配包含查询中指定的所有元素的数组。 | 12 | | [`$elemMatch`]() | 如果array字段中的元素符合所有指定`$elemMatch`条件,则选择文档。 | 13 | | [`$size`]() | 如果数组字段为指定大小,则选择文档。 | 14 | 15 | 有关查询数组字段的示例,请参见: 16 | 17 | - 查询数组 18 | - 查询嵌入式文档数组 19 | 20 | 21 | 22 | 译者:李冠飞 23 | 24 | 校对: -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-ensureIndex.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.ensureIndex() 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [定义](#definition) 8 | 9 | * [附加信息](#additional-information) 10 | 11 | ## 定义 12 | 13 | * `db.collection.` `ensureIndex`(键,选项) 14 | 15 | * *从3.0.0版开始不推荐使用:*`db.collection.ensureIndex()`现在是的别名 `db.collection.createIndex()`。 16 | 17 | 如果索引尚不存在,则在指定字段上创建索引。 18 | 19 | ## 附加信息 20 | 21 | * 使用db.collection.createIndex()而不是db.collection.ensureIndex()来创建新索引。 22 | 23 | * 本手册的索引部分用于 MongoDB 中索引和索引的完整文档。 24 | 25 | * db.collection.getIndexes()查看集合的现有索引的规范。 26 | 27 | 28 | 29 | 译者:李冠飞 30 | 31 | 校对: -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/query-plan-cache-commands.md: -------------------------------------------------------------------------------- 1 | # 查询计划缓存命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`planCacheClear`](query-plan-cache-commands.md) | 删除集合的缓存查询计划。 | 10 | | [`planCacheClearFilters`](query-plan-cache-commands.md) | 清除集合的索引过滤器。 | 11 | | [`planCacheListFilters`](query-plan-cache-commands.md) | 列出集合的索引过滤器。 | 12 | | [`planCacheListPlans`](query-plan-cache-commands.md) | 显示指定查询模型的缓存查询计划。 | 13 | | [`planCacheListQueryShapes`](query-plan-cache-commands.md) | 显示存在其缓存的查询计划的查询模型。 | 14 | | [`planCacheSetFilter`](query-plan-cache-commands.md) | 为集合设置索引过滤器。 | 15 | 16 | 译者:李冠飞 17 | 18 | 校对: 19 | 20 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Bitwise-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)按位查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ------------------- | ------------------------------------------------------------ | 11 | | [`$bitsAllClear`]() | 匹配数字或二进制值,其中一组位的*所有*值均为`0`。 | 12 | | [`$bitsAllSet`]() | 匹配数字或二进制值,其中一组位的*所有*值均为`1`。 | 13 | | [`$bitsAnyClear`]() | 匹配数值或二进制值,在这些数值或二进制值中,一组位的位置中*任何*位的值为`0`。 | 14 | | [`$bitsAnySet`]() | 匹配数值或二进制值,在这些数值或二进制值中,一组位的位置中*任何*位的值为`1`。 | 15 | 16 | 17 | 18 | 译者:李冠飞 19 | 20 | 校对: -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/user-management-commands.md: -------------------------------------------------------------------------------- 1 | # 用户管理命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`createUser`](user-management-commands.md) | 创建一个新用户。 | 10 | | [`dropAllUsersFromDatabase`](user-management-commands.md) | 删除与数据库关联的所有用户。 | 11 | | [`dropUser`](user-management-commands.md) | 删除一个用户。 | 12 | | [`grantRolesToUser`](user-management-commands.md) | 向用户授予角色及其特权。 | 13 | | [`revokeRolesFromUser`](user-management-commands.md) | 从用户删除角色。 | 14 | | [`updateUser`](user-management-commands.md) | 更新用户的数据。 | 15 | | [`usersInfo`](user-management-commands.md) | 返回有关指定用户的信息。 | 16 | 17 | 译者:李冠飞 18 | 19 | 校对: 20 | 21 | -------------------------------------------------------------------------------- /docs/Aggregation/Map-Reduce/Map-Reduce-Concurrency.md: -------------------------------------------------------------------------------- 1 | # [ ](#)Map-Reduce 并发 2 | 3 | []() 4 | 5 | map-reduce 操作由许多任务组成,包括从输入集合中读取,执行`map` function,执行`reduce` function,在处理期间写入临时集合以及写入输出集合。 6 | 7 | 在操作期间,map-reduce 采用以下锁定: 8 | 9 | * 读取阶段采用读锁定。它产生每 100 个文件。 10 | 11 | * insert 进入临时集合会为单次写入执行写锁定。 12 | 13 | * 如果输出集合不存在,则输出集合的创建将采用写入锁定。 14 | 15 | * 如果输出集合存在,则输出操作(即:`merge`,`replace`,`reduce`)将执行写入锁定。此写锁定是 global,并阻止[mongod]()实例上的所有操作。 16 | > **注意** 17 | > 18 | > 后处理期间的最终写锁定使结果自动显示。然而,输出操作`merge`和`reduce`可能需要时间来处理。对于`merge`和`reduce`,该 `nonAtomic`标志可用,从而释放写入每个输出文档之间的锁定。从MongoDB 4.2开始,不推荐使用`nonAtomic: false`显式设置。有关[`db.collection.mapReduce()`]()更多信息,请参见参考。 19 | 20 | 21 | 22 | 译者:李冠飞 23 | 24 | 校对: -------------------------------------------------------------------------------- /aggregation/map-reduce/map-reduce-concurrency.md: -------------------------------------------------------------------------------- 1 | # Map-Reduce 并发 2 | 3 | map-reduce 操作由许多任务组成,包括从输入集合中读取,执行`map` function,执行`reduce` function,在处理期间写入临时集合以及写入输出集合。 4 | 5 | 在操作期间,map-reduce 采用以下锁定: 6 | 7 | * 读取阶段采用读锁定。它产生每 100 个文件。 8 | * insert 进入临时集合会为单次写入执行写锁定。 9 | * 如果输出集合不存在,则输出集合的创建将采用写入锁定。 10 | * 如果输出集合存在,则输出操作\(即:`merge`,`replace`,`reduce`\)将执行写入锁定。此写锁定是 global,并阻止[mongod](map-reduce-concurrency.md)实例上的所有操作。 11 | 12 | > **注意** 13 | > 14 | > 后处理期间的最终写锁定使结果自动显示。然而,输出操作`merge`和`reduce`可能需要时间来处理。对于`merge`和`reduce`,该 `nonAtomic`标志可用,从而释放写入每个输出文档之间的锁定。从MongoDB 4.2开始,不推荐使用`nonAtomic: false`显式设置。有关[`db.collection.mapReduce()`](map-reduce-concurrency.md)更多信息,请参见参考。 15 | 16 | 译者:李冠飞 17 | 18 | 校对: 19 | 20 | -------------------------------------------------------------------------------- /aggregation/aggregation-reference/README.md: -------------------------------------------------------------------------------- 1 | # 聚合参考 2 | 3 | * [聚合管道快速参考](aggregation-pipeline-quick-reference.md) 4 | 5 | 聚合管道的快速参考卡。 6 | 7 | * [聚合命令](aggregation-commands.md) 8 | 9 | 数据聚合命令的引用,该命令为MongoDB的聚合功能提供接口。 10 | 11 | * [聚合命令比较](aggregation-commands-commparison.md) 12 | 13 | [MapReduce](./)和[Aggregate](./)命令的比较。 14 | 15 | * [聚合管道操作符](../../can-kao/yun-suan-fu/aggregation-pipeline-operators/) 16 | 17 | 聚合管道操作有一个操作符集合,可用于在管道阶段中定义和操作文档。 18 | 19 | * [聚合表达式中的变量](variables-in-aggregation-expressions.md) 20 | 21 | 在聚合管道表达式中使用变量。 22 | 23 | * [SQL 到聚合映射图表](sql-to-aggregation-mapping-chart.md) 24 | 25 | 使用MongoDB和常见SQL语句中的聚合管道和操作符概述SQL和MongoDB中的常见聚合操作。 26 | 27 | 译者:李冠飞 28 | 29 | 校对:李冠飞 30 | 31 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Evaluation-Query-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)评估查询运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ----------------- | ---------------------------------------------- | 11 | | [`$expr`]() | 允许在查询语言中使用聚合表达式。 | 12 | | [`$jsonSchema`]() | 根据给定的JSON Schema验证文档。 | 13 | | [`$mod`]() | 对字段的值执行模运算并选择具有指定结果的文档。 | 14 | | [`$regex`]() | 选择值与指定的正则表达式匹配的文档。 | 15 | | [`$text`]() | 执行文本搜索。 | 16 | | [`$where`]() | 匹配满足JavaScript表达式的文档。 | 17 | 18 | 19 | 20 | 译者:李冠飞 21 | 22 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Query-Plan-Cache-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)查询计划缓存命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ------------------------------ | ------------------------------------ | 11 | | [`planCacheClear`]() | 删除集合的缓存查询计划。 | 12 | | [`planCacheClearFilters`]() | 清除集合的索引过滤器。 | 13 | | [`planCacheListFilters`]() | 列出集合的索引过滤器。 | 14 | | [`planCacheListPlans`]() | 显示指定查询模型的缓存查询计划。 | 15 | | [`planCacheListQueryShapes`]() | 显示存在其缓存的查询计划的查询模型。 | 16 | | [`planCacheSetFilter`]() | 为集合设置索引过滤器。 | 17 | 18 | 19 | 20 | 译者:李冠飞 21 | 22 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/User-Management-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)用户管理命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ------------------------------ | ---------------------------- | 11 | | [`createUser`]() | 创建一个新用户。 | 12 | | [`dropAllUsersFromDatabase`]() | 删除与数据库关联的所有用户。 | 13 | | [`dropUser`]() | 删除一个用户。 | 14 | | [`grantRolesToUser`]() | 向用户授予角色及其特权。 | 15 | | [`revokeRolesFromUser`]() | 从用户删除角色。 | 16 | | [`updateUser`]() | 更新用户的数据。 | 17 | | [`usersInfo`]() | 返回有关指定用户的信息。 | 18 | 19 | 20 | 21 | 译者:李冠飞 22 | 23 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/lt.md: -------------------------------------------------------------------------------- 1 | # $lt 2 | 3 | **$lt** 4 | 5 | _语法_:`{field: {$lt: value} }` 6 | 7 | `$lt`选择的值`field`小于(即`<`)指定的文档 `value`。 8 | 9 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 10 | 11 | 考虑以下示例: 12 | 13 | ```text 14 | db.inventory.find( { qty: { $lt: 20 } } ) 15 | ``` 16 | 17 | 此查询将选择`inventory`集合中`qty`字段值小于`20`的所有文档。 18 | 19 | 考虑以下示例,该示例将`$lt`运算符与嵌入式文档中的字段一起使用: 20 | 21 | ```text 22 | db.inventory.update( { "carrier.fee": { $lt: 20 } }, { $set: { price: 9.99 } } ) 23 | ``` 24 | 25 | `update()`操作将`price`在包含嵌入文档的文档中设置字段值,该嵌入文档`carrier`的`fee`字段值小于`20`。 26 | 27 | > **也可以看看** 28 | > 29 | > `find()`,`update()`,`$set`。 30 | 31 | 译者:李冠飞 32 | 33 | 校对: 34 | 35 | -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Query-and-Write-Operation-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)查询和写操作命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ------------------- | ---------------------------------- | 11 | | [`delete`]() | 删除一个或多个文档。 | 12 | | [`find`]() | 返回集合或视图中的文档。 | 13 | | [`findAndModify`]() | 返回并修改单个文档。 | 14 | | [`getLastError`]() | 返回上一个操作的成功状态。 | 15 | | [`getMore`]() | 返回当前由游标指向的批处理文档。 | 16 | | [`insert`]() | 插入一个或多个文档。 | 17 | | [`resetError`]() | *不推荐使用*。重置上一个错误状态。 | 18 | | [`update`]() | 更新一个或多个文档。 | 19 | 20 | 21 | 22 | 译者:李冠飞 23 | 24 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/lte.md: -------------------------------------------------------------------------------- 1 | # $lte 2 | 3 | **$lte** 4 | 5 | _语法_:`{field: {$lte: value} }` 6 | 7 | `$lte`选择的值`field`小于或等于`<=`指定`value`的文档 。 8 | 9 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 10 | 11 | 考虑以下示例: 12 | 13 | ```text 14 | db.inventory.find( { qty: { $lte: 20 } } ) 15 | ``` 16 | 17 | 此查询将选择`inventory`集合中`qty`字段值小于或等于`20`的所有文档。 18 | 19 | 考虑以下示例,该示例将`$lte`运算符与嵌入式文档中的字段一起使用: 20 | 21 | ```text 22 | db.inventory.update( { "carrier.fee": { $lte: 5 } }, { $set: { price: 9.99 } } ) 23 | ``` 24 | 25 | `update()`操作将`price`在包含嵌入式文档的文档中设置字段值,该嵌入式文档`carrier`的`fee`字段值小于或等于`5`。 26 | 27 | > **也可以看看** 28 | > 29 | > `find()`,`update()`,`$set`。 30 | 31 | 译者:李冠飞 32 | 33 | 校对: 34 | 35 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/gte.md: -------------------------------------------------------------------------------- 1 | # $gte 2 | 3 | **$gte** 4 | 5 | _语法_:`{field: {$gte: value} }` 6 | 7 | `$gte`选择的值`field`大于或等于(即`>=`)指定值(例如`value`)的文档 。 8 | 9 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 10 | 11 | 考虑以下示例: 12 | 13 | ```text 14 | db.inventory.find( { qty: { $gte: 20 } } ) 15 | ``` 16 | 17 | 此查询将选择的所有文件`inventory`,其中`qty`字段的值大于或等于`20`。 18 | 19 | 考虑以下示例,该示例将`$gte`运算符与嵌入式文档中的字段一起使用: 20 | 21 | ```text 22 | db.inventory.update( { "carrier.fee": { $gte: 2 } }, { $set: { price: 9.99 } } ) 23 | ``` 24 | 25 | `update()`操作将设置`price`包含嵌入文档`carrier`的`fee`字段的值,该嵌入文档 的字段值大于或等于 `2`。 26 | 27 | > **也可以看看** 28 | > 29 | > `find()`,`update()`,`$set`。 30 | 31 | 译者:李冠飞 32 | 33 | 校对: 34 | 35 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/sessions-commands.md: -------------------------------------------------------------------------------- 1 | # 会话命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 指令 | 描述 | 8 | | :--- | :--- | 9 | | [`abortTransaction`](sessions-commands.md) | 中止事务 _版本4.0中的新功能。_ | 10 | | [`commitTransaction`](sessions-commands.md) | 提交事务 _版本4.0中的新功能。_ | 11 | | [`endSessions`](sessions-commands.md) | 在会话超时期限之前终止会话。 _3.6版的新功能。_ | 12 | | [`killAllSessions`](sessions-commands.md) | 杀死所有会话。 _3.6版的新功能。_ | 13 | | [`killAllSessionsByPattern`](sessions-commands.md) | 杀死所有与指定模式匹配的会话 _3.6版的新功能。_ | 14 | | [`killSessions`](sessions-commands.md) | 杀死指定的会话。 _3.6版的新功能。_ | 15 | | [`refreshSessions`](sessions-commands.md) | 刷新空闲会话。 _3.6版的新功能。_ | 16 | | [`startSession`](sessions-commands.md) | 开始新的会话。 _3.6版的新功能。_ | 17 | 18 | 译者:李冠飞 19 | 20 | 校对: 21 | 22 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/lt.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$lt 2 | 3 | []() 4 | 5 | **$lt** 6 | 7 | *语法*:`{field: {$lt: value} }` 8 | 9 | `$lt`选择的值`field`小于(即`<`)指定的文档 `value`。 10 | 11 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 12 | 13 | 考虑以下示例: 14 | 15 | ```powershell 16 | db.inventory.find( { qty: { $lt: 20 } } ) 17 | ``` 18 | 19 | 此查询将选择`inventory`集合中`qty`字段值小于`20`的所有文档。 20 | 21 | 考虑以下示例,该示例将`$lt`运算符与嵌入式文档中的字段一起使用: 22 | 23 | ```powershell 24 | db.inventory.update( { "carrier.fee": { $lt: 20 } }, { $set: { price: 9.99 } } ) 25 | ``` 26 | 27 | `update()`操作将`price`在包含嵌入文档的文档中设置字段值,该嵌入文档`carrier`的`fee`字段值小于`20`。 28 | 29 | > **也可以看看** 30 | > 31 | > `find()`,`update()`,`$set`。 32 | 33 | 34 | 35 | 译者:李冠飞 36 | 37 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/update-operators/field-update-operators.md: -------------------------------------------------------------------------------- 1 | # 字段更新运算符 2 | 3 | > **注意** 4 | > 5 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`$currentDate`](field-update-operators.md) | 将字段的值设置为当前日期,即日期或时间戳。 | 10 | | [`$inc`](field-update-operators.md) | 将字段的值增加指定的数量。 | 11 | | [`$min`](field-update-operators.md) | 仅当指定值小于现有字段值时才更新该字段。 | 12 | | [`$max`](field-update-operators.md) | 仅当指定值大于现有字段值时才更新该字段。 | 13 | | [`$mul`](field-update-operators.md) | 将字段的值乘以指定的数量。 | 14 | | [`$rename`](field-update-operators.md) | 重命名字段。 | 15 | | [`$set`](field-update-operators.md) | 设置文档中字段的值。 | 16 | | [`$setOnInsert`](field-update-operators.md) | 如果更新导致插入文档,则设置字段的值。对修改现有文档的更新操作没有影响。 | 17 | | [`$unset`](field-update-operators.md) | 从文档中删除指定的字段。 | 18 | 19 | 译者:李冠飞 20 | 21 | 校对: 22 | 23 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/lte.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$lte 2 | 3 | []() 4 | 5 | **$lte** 6 | 7 | *语法*:`{field: {$lte: value} }` 8 | 9 | `$lte`选择的值`field`小于或等于`<=`指定`value`的文档 。 10 | 11 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 12 | 13 | 考虑以下示例: 14 | 15 | ```powershell 16 | db.inventory.find( { qty: { $lte: 20 } } ) 17 | ``` 18 | 19 | 此查询将选择`inventory`集合中`qty`字段值小于或等于`20`的所有文档。 20 | 21 | 考虑以下示例,该示例将`$lte`运算符与嵌入式文档中的字段一起使用: 22 | 23 | ```powershell 24 | db.inventory.update( { "carrier.fee": { $lte: 5 } }, { $set: { price: 9.99 } } ) 25 | ``` 26 | 27 | `update()`操作将`price`在包含嵌入式文档的文档中设置字段值,该嵌入式文档`carrier`的`fee`字段值小于或等于`5`。 28 | 29 | > **也可以看看** 30 | > 31 | > `find()`,`update()`,`$set`。 32 | 33 | 34 | 35 | 译者:李冠飞 36 | 37 | 校对: -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/query-and-write-operation-commands.md: -------------------------------------------------------------------------------- 1 | # 查询和写操作命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`delete`](query-and-write-operation-commands.md) | 删除一个或多个文档。 | 10 | | [`find`](query-and-write-operation-commands.md) | 返回集合或视图中的文档。 | 11 | | [`findAndModify`](query-and-write-operation-commands.md) | 返回并修改单个文档。 | 12 | | [`getLastError`](query-and-write-operation-commands.md) | 返回上一个操作的成功状态。 | 13 | | [`getMore`](query-and-write-operation-commands.md) | 返回当前由游标指向的批处理文档。 | 14 | | [`insert`](query-and-write-operation-commands.md) | 插入一个或多个文档。 | 15 | | [`resetError`](query-and-write-operation-commands.md) | _不推荐使用_。重置上一个错误状态。 | 16 | | [`update`](query-and-write-operation-commands.md) | 更新一个或多个文档。 | 17 | 18 | 译者:李冠飞 19 | 20 | 校对: 21 | 22 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/gte.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$gte 2 | 3 | []() 4 | 5 | **$gte** 6 | 7 | *语法*:`{field: {$gte: value} }` 8 | 9 | `$gte`选择的值`field`大于或等于(即`>=`)指定值(例如`value`)的文档 。 10 | 11 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 12 | 13 | 考虑以下示例: 14 | 15 | ```powershell 16 | db.inventory.find( { qty: { $gte: 20 } } ) 17 | ``` 18 | 19 | 此查询将选择的所有文件`inventory`,其中`qty`字段的值大于或等于`20`。 20 | 21 | 考虑以下示例,该示例将`$gte`运算符与嵌入式文档中的字段一起使用: 22 | 23 | ```powershell 24 | db.inventory.update( { "carrier.fee": { $gte: 2 } }, { $set: { price: 9.99 } } ) 25 | ``` 26 | 27 | `update()`操作将设置`price`包含嵌入文档`carrier`的`fee`字段的值,该嵌入文档 的字段值大于或等于 `2`。 28 | 29 | > **也可以看看** 30 | > 31 | > `find()`,`update()`,`$set`。 32 | 33 | 34 | 35 | 译者:李冠飞 36 | 37 | 校对: -------------------------------------------------------------------------------- /docs/Aggregation/Aggregation-Pipeline/Aggregation-Pipeline-and-Sharded-Collections.md: -------------------------------------------------------------------------------- 1 | # [ ](#)聚合管道和分片集合 2 | 3 | []() 4 | 5 | []() 6 | 7 | 在本页面 8 | 9 | * [行为](#behavior) 10 | 11 | * [优化](#optimization) 12 | 13 | 聚合管道支持对[分片]()集合的操作。本节介绍特定于[聚合管道](../Aggregation-Pipeline.md)和分片集合的行为。 14 | 15 | []() 16 | 17 | ## 行为 18 | 19 | Mongodb 3.2 版本的改变 20 | 21 | 如果管道以 shard key 上的精确[$match]()开头,则整个管道仅在匹配的分片上运行。以前,管道将被拆分,合并它的工作必须在主分片上完成。 22 | 23 | 对于必须在多个分片上运行的聚合操作,如果操作不需要在数据库的主分片上运行,则这些操作将会将结果路由到随机分片以合并结果,以避免该数据库的主分片超载。 [$out]()阶段和[$lookup]()阶段需要在数据库的主分片上运行。 24 | 25 | []() 26 | 27 | ## 优化 28 | 29 | 在将聚合管道分成两部分时,管道被拆分以确保分片在考虑优化的情况下执行尽可能多的阶段。 30 | 31 | 要查看管道是如何拆分的,请在[db.collection.aggregate()]()方法中包含[explain]()选项。 32 | 33 | 优化可能会在不同版本之间发生变化。 34 | 35 | 36 | 37 | 译者:李冠飞 38 | 39 | 校对:李冠飞 -------------------------------------------------------------------------------- /docs/Aggregation/Aggregation-Reference.md: -------------------------------------------------------------------------------- 1 | # [ ](#)聚合参考 2 | 3 | []() 4 | 5 | * [聚合管道快速参考](Aggregation-Reference/Aggregation-Pipeline-Quick-Reference.md) 6 | 7 | 聚合管道的快速参考卡。 8 | 9 | * [聚合命令](Aggregation-Reference/Aggregation-Commands.md) 10 | 11 | 数据聚合命令的引用,该命令为MongoDB的聚合功能提供接口。 12 | 13 | * [聚合命令比较](Aggregation-Reference/Aggregation-Commands-Commparison.md) 14 | 15 | [MapReduce]()和[Aggregate]()命令的比较。 16 | 17 | * [聚合管道操作符](../Reference/Operators/Aggregation-Pipeline-Operators.md) 18 | 19 | 聚合管道操作有一个操作符集合,可用于在管道阶段中定义和操作文档。 20 | 21 | * [聚合表达式中的变量](Aggregation-Reference/Variables-in-Aggregation-Expressions.md) 22 | 23 | 在聚合管道表达式中使用变量。 24 | 25 | * [SQL 到聚合映射图表](Aggregation-Reference/SQL-to-Aggregation-Mapping-Chart.md) 26 | 27 | 使用MongoDB和常见SQL语句中的聚合管道和操作符概述SQL和MongoDB中的常见聚合操作。 28 | 29 | 30 | 31 | 译者:李冠飞 32 | 33 | 校对:李冠飞 -------------------------------------------------------------------------------- /docs/Install-MongoDB/Install-MongoDB-Community-Edition.md: -------------------------------------------------------------------------------- 1 | # 安装MongoDB社区版 2 | 3 | 下方文档提供了安装MongoDB社区版的说明。 4 | 5 | - [在Linux上安装](https://docs.mongodb.com/v4.2/administration/install-on-linux/) 6 | 7 | 在Linux上安装MongoDB Community Edition和必需的依赖项。 8 | 9 | - [在macOS上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-os-x/) 10 | 11 | 从MongoDB归档文件在macOS系统上安装MongoDB Community Edition。 12 | 13 | - [在Windows上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-windows/) 14 | 15 | 在Windows系统上安装MongoDB Community Edition,并可以选择将MongoDB作为Windows服务启动。 16 | 17 | ← [安装MongoDB](https://docs.mongodb.com/v4.2/installation/)[在Linux上安装MongoDB社区版](https://docs.mongodb.com/v4.2/administration/install-on-linux/) → 18 | 19 | 20 | 21 | 22 | 23 | 原文链接:https://docs.mongodb.com/v4.2/administration/install-community/ 24 | 25 | 译者:小芒果 26 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/ne.md: -------------------------------------------------------------------------------- 1 | # $ne 2 | 3 | **$ne** 4 | 5 | _语法_:`{field: {$ne: value} }` 6 | 7 | `$ne`选择的值`field`不等于指定的文档 `value`。这包括不包含的文档`field`。 8 | 9 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 10 | 11 | 考虑以下示例: 12 | 13 | ```text 14 | db.inventory.find( { qty: { $ne: 20 } } ) 15 | ``` 16 | 17 | 此查询将选择`inventory`集合中`qty`字段值不等于`20`的所有文档,包括不包含该`qty`字段的那些文档。 18 | 19 | 考虑以下示例,该示例`$ne`在嵌入式文档中使用运算符和字段: 20 | 21 | ```text 22 | db.inventory.update( { "carrier.state": { $ne: "NY" } }, { $set: { qty: 20 } } ) 23 | ``` 24 | 25 | `update()`操作将`qty`在包含嵌入式文档的文档中设置字段值,该嵌入式文档`carrier`的`state`字段值不等于“ NY”,或者该`state`字段或`carrier`嵌入式文档不存在。 26 | 27 | 不等式操作符`$ne`是_不_非常有选择性的,因为它往往是指数的很大一部分相匹配。结果,在许多情况下,`$ne`带有索引的查询的性能可能不比`$ne`必须扫描集合中所有文档的查询更好。另请参阅查询选择性。 28 | 29 | > **也可以看看** 30 | > 31 | > `find()`,`update()`,`$set`。 32 | 33 | 译者:李冠飞 34 | 35 | 校对: 36 | 37 | -------------------------------------------------------------------------------- /install-mongodb/install-mongodb-community-edition/README.md: -------------------------------------------------------------------------------- 1 | # 安装MongoDB社区版 2 | 3 | 下方文档提供了安装MongoDB社区版的说明。 4 | 5 | * [在Linux上安装](https://docs.mongodb.com/v4.2/administration/install-on-linux/) 6 | 7 | 在Linux上安装MongoDB Community Edition和必需的依赖项。 8 | 9 | * [在macOS上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-os-x/) 10 | 11 | 从MongoDB归档文件在macOS系统上安装MongoDB Community Edition。 12 | 13 | * [在Windows上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-windows/) 14 | 15 | 在Windows系统上安装MongoDB Community Edition,并可以选择将MongoDB作为Windows服务启动。 16 | 17 | ← [安装MongoDB](https://docs.mongodb.com/v4.2/installation/)[在Linux上安装MongoDB社区版](https://docs.mongodb.com/v4.2/administration/install-on-linux/) → 18 | 19 | 原文链接:[https://docs.mongodb.com/v4.2/administration/install-community/](https://docs.mongodb.com/v4.2/administration/install-community/) 20 | 21 | 译者:小芒果 22 | 23 | -------------------------------------------------------------------------------- /docs/Indexes/Index-Properties.md: -------------------------------------------------------------------------------- 1 | ## 索引特性 2 | ### 索引的unique特性 3 | 开启[unique](https:_docs.mongodb.com_manual_core_index-unique)选项,索引对应字段具有唯一性,对应字段拒绝重复值。除唯一性约束外,在功能上,索引的unique特性可与其他特性交替使用。 4 | ### 索引的Partial特性 5 | 3.2版本新特性 6 | 7 | 特性相关选项设置后,将仅索引集合中满足指定筛选表达式的文档。对集合中的文档子集创建索引,设置了partial特性的索引将占用更低的存储,并降低mongodb创建索引和维护索引的性能开销。 8 | 9 | 在功能上,索引的**Partial**特性是sparse特性的超集,当一个索引同时拥有两种特性时,以Partial特性优先。 10 | 11 | ### 索引的Sparse特性 12 | 索引的 [sparse](https:_docs.mongodb.com_manual_core_index-sparse) 特性确保只对存在索引字段的文档创建索引。创建索引时将会跳过那些没有对应字段值的文档。 13 | 14 | 你或许可以将**sparse**选项和**unique**选项结合使用,以防止索引字段插入重复值,并对对应索引字段缺失的文档不创建索引,提升数据库效率。 15 | 16 | ### 索引的TTL特性 17 | 索引的[TTL](https:_docs.mongodb.com_manual_core_index-ttl)特性,允许MongoDB在一定时间后自动从集合中移除文档。这非常适合某些类型的信息,例如:机器生成的事件数据、日志和会话信息,这些信息只需要在数据库中保留有限的时间。 18 | 19 | 有关实现说明,请参见:[Expire Data from Collections by Setting TTL](https:_docs.mongodb.com_manual_tutorial_expire-data) 20 | 21 | 译者:程哲欣 22 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/ne.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ne 2 | 3 | []() 4 | 5 | **$ne** 6 | 7 | *语法*:`{field: {$ne: value} }` 8 | 9 | `$ne`选择的值`field`不等于指定的文档 `value`。这包括不包含的文档`field`。 10 | 11 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 12 | 13 | 考虑以下示例: 14 | 15 | ```powershell 16 | db.inventory.find( { qty: { $ne: 20 } } ) 17 | ``` 18 | 19 | 此查询将选择`inventory`集合中`qty`字段值不等于`20`的所有文档,包括不包含该`qty`字段的那些文档。 20 | 21 | 考虑以下示例,该示例`$ne`在嵌入式文档中使用运算符和字段: 22 | 23 | ```powershell 24 | db.inventory.update( { "carrier.state": { $ne: "NY" } }, { $set: { qty: 20 } } ) 25 | ``` 26 | 27 | `update()`操作将`qty`在包含嵌入式文档的文档中设置字段值,该嵌入式文档`carrier`的`state`字段值不等于“ NY”,或者该`state`字段或`carrier`嵌入式文档不存在。 28 | 29 | 不等式操作符`$ne`是*不*非常有选择性的,因为它往往是指数的很大一部分相匹配。结果,在许多情况下,`$ne`带有索引的查询的性能可能不比`$ne`必须扫描集合中所有文档的查询更好。另请参阅查询选择性。 30 | 31 | > **也可以看看** 32 | > 33 | > `find()`,`update()`,`$set`。 34 | 35 | 36 | 37 | 译者:李冠飞 38 | 39 | 校对: -------------------------------------------------------------------------------- /indexes/index-properties/README.md: -------------------------------------------------------------------------------- 1 | # 索引特性 2 | 3 | ## 索引的unique特性 4 | 5 | 开启[unique](https:_docs.mongodb.com_manual_core_index-unique)选项,索引对应字段具有唯一性,对应字段拒绝重复值。除唯一性约束外,在功能上,索引的unique特性可与其他特性交替使用。 6 | 7 | ## 索引的Partial特性 8 | 9 | 3.2版本新特性 10 | 11 | 特性相关选项设置后,将仅索引集合中满足指定筛选表达式的文档。对集合中的文档子集创建索引,设置了partial特性的索引将占用更低的存储,并降低mongodb创建索引和维护索引的性能开销。 12 | 13 | 在功能上,索引的**Partial**特性是sparse特性的超集,当一个索引同时拥有两种特性时,以Partial特性优先。 14 | 15 | ## 索引的Sparse特性 16 | 17 | 索引的 [sparse](https:_docs.mongodb.com_manual_core_index-sparse) 特性确保只对存在索引字段的文档创建索引。创建索引时将会跳过那些没有对应字段值的文档。 18 | 19 | 你或许可以将**sparse**选项和**unique**选项结合使用,以防止索引字段插入重复值,并对对应索引字段缺失的文档不创建索引,提升数据库效率。 20 | 21 | ## 索引的TTL特性 22 | 23 | 索引的[TTL](https:_docs.mongodb.com_manual_core_index-ttl)特性,允许MongoDB在一定时间后自动从集合中移除文档。这非常适合某些类型的信息,例如:机器生成的事件数据、日志和会话信息,这些信息只需要在数据库中保留有限的时间。 24 | 25 | 有关实现说明,请参见:[Expire Data from Collections by Setting TTL](https:_docs.mongodb.com_manual_tutorial_expire-data) 26 | 27 | 译者:程哲欣 28 | 29 | -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/role-management-commands.md: -------------------------------------------------------------------------------- 1 | # 角色管理命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`createRole`](role-management-commands.md) | 创建一个角色并指定其特权。 | 10 | | [`dropRole`](role-management-commands.md) | 删除用户定义的角色。 | 11 | | [`dropAllRolesFromDatabase`](role-management-commands.md) | 从数据库中删除所有用户定义的角色。 | 12 | | [`grantPrivilegesToRole`](role-management-commands.md) | 将特权分配给用户定义的角色。 | 13 | | [`grantRolesToRole`](role-management-commands.md) | 指定角色,用户定义的角色将从这些角色继承特权。 | 14 | | [`invalidateUserCache`](role-management-commands.md) | 刷新用户信息的内存缓存,包括凭据和角色。 | 15 | | [`revokePrivilegesFromRole`](role-management-commands.md) | 从用户定义的角色中删除指定的特权。 | 16 | | [`revokeRolesFromRole`](role-management-commands.md) | 从用户定义的角色中删除指定的继承角色。 | 17 | | [`rolesInfo`](role-management-commands.md) | 返回指定角色的信息。 | 18 | | [`updateRole`](role-management-commands.md) | 更新用户定义的角色。 | 19 | 20 | 译者:李冠飞 21 | 22 | 校对: 23 | 24 | -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Sessions-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)会话命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 指令 | 描述 | 10 | | ------------------------------ | --------------------------------------------------- | 11 | | [`abortTransaction`]() | 中止事务
*版本4.0中的新功能。* | 12 | | [`commitTransaction`]() | 提交事务
*版本4.0中的新功能。* | 13 | | [`endSessions`]() | 在会话超时期限之前终止会话。
*3.6版的新功能。* | 14 | | [`killAllSessions`]() | 杀死所有会话。
*3.6版的新功能。* | 15 | | [`killAllSessionsByPattern`]() | 杀死所有与指定模式匹配的会话
*3.6版的新功能。* | 16 | | [`killSessions`]() | 杀死指定的会话。
*3.6版的新功能。* | 17 | | [`refreshSessions`]() | 刷新空闲会话。
*3.6版的新功能。* | 18 | | [`startSession`]() | 开始新的会话。
*3.6版的新功能。* | 19 | 20 | 21 | 22 | 译者:李冠飞 23 | 24 | 校对: -------------------------------------------------------------------------------- /mongodb-crud-operations/text-search/text-search-languages.md: -------------------------------------------------------------------------------- 1 | # 文本索引语言 2 | 3 | [文本索引](https://docs.mongodb.com/master/core/index-text/#index-feature-text) 和[`$text`](https://docs.mongodb.com/master/reference/operator/query/text/#op._S_text) 运算符可用于下列语言,并接受两个字母的ISO 639-1语言代码或语言名称的长形式: 4 | 5 | | 语言名称 | ISO 639-1\(双字母代码\) | 6 | | :--- | :--- | 7 | | `danish` | `da` | 8 | | `dutch` | `nl` | 9 | | `english` | `en` | 10 | | `finnish` | `fi` | 11 | | `french` | `fr` | 12 | | `german` | `de` | 13 | | `hungarian` | `hu` | 14 | | `italian` | `it` | 15 | | `norwegian` | `nb` | 16 | | `portuguese` | `pt` | 17 | | `romanian` | `ro` | 18 | | `russian` | `ru` | 19 | | `spanish` | `es` | 20 | | `swedish` | `sv` | 21 | | `turkish` | `tr` | 22 | 23 | > **\[success\] Note** 24 | > 25 | > 如果指定语言值为**“none”**,则文本搜索使用简单的标记化,不包含停止词列表和词干分析。 26 | 27 | 另看: 28 | 29 | [Specify a Language for Text Index](https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/) 30 | 31 | 译者:杨帅 32 | 33 | 校对:杨帅 34 | 35 | -------------------------------------------------------------------------------- /mongodb-crud-operations/mongodb-crud-concepts/tailable-cursors.md: -------------------------------------------------------------------------------- 1 | # Tailable 游标 2 | 3 | 默认情况下,当客户端使用完游标中的所有结果时,MongoDB将自动关闭游标。但是,对于有上限的集合,您可以使用一个可定制的游标,该游标在客户端穷尽初始游标的结果后保持打开状态。可跟踪游标在概念上等同于带-f选项的tail Unix命令\(即“follow”模式\)。在客户端向有上限的集合中插入新的额外文档之后,可定制游标将继续检索文档。 4 | 5 | 在具有高写量的有上限集合上使用可定制游标,因为索引不实用。例如,MongoDB复制使用可跟踪的游标跟踪主服务器的[oplog](https://docs.mongodb.com/manual/reference/glossary/#term-oplog). 6 | 7 | > **\[success\] 注意** 8 | > 9 | > 如果查询位于索引字段上,则不要使用可跟踪游标,而是使用常规游标。跟踪查询返回的索引字段的最后一个值。要检索新添加的文档,使用查询条件中索引字段的最后一个值再次查询集合,如下面的示例所示: 10 | > 11 | > ```text 12 | > db..find( { indexedField: { $gt: } } ) 13 | > ``` 14 | 15 | 考虑以下与可跟踪游标相关的行为: 16 | 17 | * 可跟踪游标不使用索引,并按自然顺序返回文档。 18 | * 由于可tailable游标不使用索引,因此查询的初始扫描可能开销较大;但是,在最初耗尽游标之后,后续对新添加文档的检索就不那么昂贵了。 19 | * 可跟踪游标可能会死亡或无效,如果有下列情况: 20 | 21 | * 查询返回不匹配。 22 | * 游标返回集合“末尾”的文档,然后应用程序删除该文档。 23 | 24 | 一个已死亡游标的id为0。 25 | 26 | 请参阅[驱动程序文档](https://docs.mongodb.com/ecosystem/drivers),以获取特定于驱动程序的方法以指定可跟踪游标。 27 | 28 | 译者:杨帅 29 | 30 | 校对:杨帅 31 | 32 | -------------------------------------------------------------------------------- /docs/MongoDB-CRUD-Operations/MongoDB-CRUD-Concepts/Tailable-Cursors.md: -------------------------------------------------------------------------------- 1 | # Tailable游标 2 | 3 | 默认情况下,当客户端使用完游标中的所有结果时,MongoDB将自动关闭游标。但是,对于有上限的集合,您可以使用一个可定制的游标,该游标在客户端穷尽初始游标的结果后保持打开状态。可跟踪游标在概念上等同于带-f选项的tail Unix命令(即“follow”模式)。在客户端向有上限的集合中插入新的额外文档之后,可定制游标将继续检索文档。 4 | 5 | 在具有高写量的有上限集合上使用可定制游标,因为索引不实用。例如,MongoDB复制使用可跟踪的游标跟踪主服务器的[oplog](https://docs.mongodb.com/manual/reference/glossary/#term-oplog). 6 | 7 | > **[success] 注意** 8 | > 9 | > 如果查询位于索引字段上,则不要使用可跟踪游标,而是使用常规游标。跟踪查询返回的索引字段的最后一个值。要检索新添加的文档,使用查询条件中索引字段的最后一个值再次查询集合,如下面的示例所示: 10 | > 11 | > ```shell 12 | > db..find( { indexedField: { $gt: } } ) 13 | > ``` 14 | 15 | 考虑以下与可跟踪游标相关的行为: 16 | 17 | - 可跟踪游标不使用索引,并按自然顺序返回文档。 18 | 19 | - 由于可tailable游标不使用索引,因此查询的初始扫描可能开销较大;但是,在最初耗尽游标之后,后续对新添加文档的检索就不那么昂贵了。 20 | 21 | - 可跟踪游标可能会死亡或无效,如果有下列情况: 22 | 23 | - 查询返回不匹配。 24 | - 游标返回集合“末尾”的文档,然后应用程序删除该文档。 25 | 26 | 一个已死亡游标的id为0。 27 | 28 | 请参阅[驱动程序文档](https://docs.mongodb.com/ecosystem/drivers),以获取特定于驱动程序的方法以指定可跟踪游标。 29 | 30 | 31 | 32 | 译者:杨帅 33 | 34 | 校对:杨帅 -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/gt.md: -------------------------------------------------------------------------------- 1 | # $gt 2 | 3 | **$gt** 4 | 5 | _语法_:`{field: {$gt: value} }` 6 | 7 | `$gt`选择的值`field`大于(即`>`)指定的那些文档 `value`。 8 | 9 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 10 | 11 | 考虑以下示例: 12 | 13 | ```text 14 | db.inventory.find( { qty: { $gt: 20 } } ) 15 | ``` 16 | 17 | 此查询将选择`inventory`集合中`qty`字段值大于`20`的所有文档。 18 | 19 | 考虑以下示例,该示例将`$gt`运算符与嵌入式文档中的字段一起使用: 20 | 21 | ```text 22 | db.inventory.update( { "carrier.fee": { $gt: 2 } }, { $set: { price: 9.99 } } ) 23 | ``` 24 | 25 | `update()`操作将设置`price`找到的第一个文档中包含嵌入文档`carrier`的`fee`字段的值,该嵌入文档的字段值大于`2`。 26 | 27 | 要`price`在包含嵌入文档的_所有_文档中设置该字段的值,该嵌入文档`carrier`的`fee`字段值大于`2`,请在`update()`方法中指定`multi:true`选项: 28 | 29 | ```text 30 | db.inventory.update( 31 | { "carrier.fee": { $gt: 2 } }, 32 | { $set: { price: 9.99 } }, 33 | { multi: true } 34 | ) 35 | ``` 36 | 37 | > **也可以看看** 38 | > 39 | > `find()`,`update()`,`$set`。 40 | 41 | 译者:李冠飞 42 | 43 | 校对: 44 | 45 | -------------------------------------------------------------------------------- /mongodb-versioning.md: -------------------------------------------------------------------------------- 1 | # MongoDB 版本管理 2 | 3 | 发行说明 > MongoDB 版本管理 4 | 5 | ## MongoDB 版本管理[¶](https://docs.mongodb.com/v4.2/reference/versioning/#mongodb-versioning) 6 | 7 | 重要提示 8 | 9 | 始终升级到所发布系列的最新稳定版本。 10 | 11 | MongoDB的版本管理按照`X.Y.Z`的形式,其中`X.Y`是发行版本序列号或者开发版本序列号,`Z`是版本号或者修订号。 12 | 13 | * 如果`Y`是偶数,则`X.Y`为发行版本序号;例如,`4.0`是一个发行版本序列号,`4.2`也是一个发行版本序列号。发行版本通常比较稳定,可用于生产环境。 14 | * 如果`Y`是奇数, 则`X.Y`为开发版本;例如,`4.1`是一个开发版本序列号,`4.3`也是一个开发版本序列号。开发版本应该**仅用于测试,不能用于生产环境**。 15 | 16 | 例如,MongoDB版本号`4.0.12`,`4.0`是发行版本序列号,`.12`是此发行版本的修订号。 17 | 18 | ### 新版本 19 | 20 | 发行版本系列号的改变(如`4.0`变成`4.2`)通常标志着新的特性引入,这些新特性通常无法向后兼容。 21 | 22 | ### 补丁发布 23 | 24 | 修订号的改变(例如`4.0.11`到`4.0.12`)通常标志着bug的修复,并且可以向后兼容。 25 | 26 | ### 驱动程序版本 27 | 28 | MongoDB的版本编号系统与用于MongoDB驱动程序的版本编号系统不同。 29 | 30 | ← [MongoDB 1.2.x 发行版本说明](https://docs.mongodb.com/v4.2/release-notes/1.2/) [技术支持](https://docs.mongodb.com/v4.2/support/) → 31 | 32 | 原文链接:[https://docs.mongodb.com/v4.2/reference/versioning/](https://docs.mongodb.com/v4.2/reference/versioning/) 33 | 34 | 译者: 罗治军 35 | 36 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comparison-query-operators/nin.md: -------------------------------------------------------------------------------- 1 | # $nin 2 | 3 | **$nin** 4 | 5 | _语法_:`{ field: { $nin: [ , ... ]} }` 6 | 7 | `$nin`选择以下位置的文档: 8 | 9 | * 该`field`值不在指定的范围内`array` **或** 10 | * 在`field`不存在。 11 | 12 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 13 | 14 | 考虑以下查询: 15 | 16 | ```text 17 | db.inventory.find( { qty: { $nin: [ 5, 15 ] } } ) 18 | ``` 19 | 20 | 这个查询将选择库存集合中`qty`字段值不等于`5`或`15`的所有文档。所选文档将包括那些不包含`qty`字段的文档。 21 | 22 | 如果字段包含数组,那么`$nin`操作符将选择字段中没有元素等于指定数组中的值的文档\(例如``, ``,等等\)。 23 | 24 | 考虑以下查询: 25 | 26 | ```text 27 | db.inventory.update( { tags: { $nin: [ "appliances", "school" ] } }, { $set: { sale: false } } ) 28 | ``` 29 | 30 | 这个`update()`操作将设置库存集合中的`sale`字段值,其中,`tags`字段包含一个数组,数组中没有与数组`["appliances", "school"]`中的元素匹配的元素,或者文档不包含`tags`字段。 31 | 32 | 不等运算符`$nin`的选择性不是很强,因为它经常匹配索引的很大一部分。因此,在许多情况下,带有索引的`$nin`查询的性能可能不比必须扫描集合中所有文档的`$nin`查询好。请参见查询选择性。 33 | 34 | > **也可以看看** 35 | > 36 | > `find()`,`update()`,`$set`。 37 | 38 | 译者:李冠飞 39 | 40 | 校对: 41 | 42 | -------------------------------------------------------------------------------- /docs/Install-MongoDB/Install-on-Linux-Enterprise.md: -------------------------------------------------------------------------------- 1 | # 在Linux上安装MongoDB企业版 2 | 3 | 此文档提供了为受支持的Linux系统安装MongoDB企业版的说明。 4 | 5 | - [在Red Hat上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-red-hat/) 6 | 7 | 使用软件包在Red Hat Enterprise或CentOS系统上安装MongoDB企业版和必需的依赖项。 8 | 9 | - [在Ubuntu上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-ubuntu/) 10 | 11 | 使用软件包在Ubuntu Linux系统上安装MongoDB企业版和必需的依赖项。 12 | 13 | - [在Debian上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-debian/) 14 | 15 | 使用软件包在Debian Linux系统上安装MongoDB企业版和必需的依赖项。 16 | 17 | - [在SUSE上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-suse/) 18 | 19 | 在SUSE Enterprise Linux上安装MongoDB企业版和必需的依赖项。 20 | 21 | - [在亚马逊上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-amazon/) 22 | 23 | 在Amazon Linux AMI上安装MongoDB企业版和必需的依赖项。 24 | 25 | 26 | 27 | 原文链接:https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/ 28 | 29 | 译者:小芒果 30 | -------------------------------------------------------------------------------- /mongodb-crud-operations/mongodb-crud-concepts/README.md: -------------------------------------------------------------------------------- 1 | # MongoDB CRUD概念 2 | 3 | 本节包含与MongoDB中的CRUD操作相关的其他概念的信息。 4 | 5 | **原子性,一致性和分布式操作** 6 | 7 | * [原子性和事务](https://docs.mongodb.com/manual/core/write-operations-atomicity/) 8 | * [阅读隔离度,一致性和近效性](https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/) 9 | * [分布式查询](https://docs.mongodb.com/manual/core/distributed-queries/) 10 | * [通过findAndModify进行线性化读取](https://docs.mongodb.com/manual/tutorial/perform-findAndModify-linearizable-reads/) 11 | 12 | **查询计划,性能和分析** 13 | 14 | * [查询计划](https://docs.mongodb.com/manual/core/query-plans/) 15 | * [查询优化](https://docs.mongodb.com/manual/core/query-optimization/) 16 | * [分析查询性能](https://docs.mongodb.com/manual/tutorial/analyze-query-plan/) 17 | * [写操作性能](https://docs.mongodb.com/manual/core/write-performance/) 18 | 19 | **其它** 20 | 21 | * [Tailable 游标](https://docs.mongodb.com/manual/core/tailable-cursors/) 22 | 23 | 也可以看看: 24 | 25 | [事务](https://docs.mongodb.com/manual/core/transactions/) 26 | 27 | 译者:杨帅 28 | 29 | 校对:杨帅 30 | 31 | -------------------------------------------------------------------------------- /aggregation/aggregation-pipeline/aggregation-pipeline-and-sharded-collections.md: -------------------------------------------------------------------------------- 1 | # 聚合管道和分片集合 2 | 3 | 在本页面 4 | 5 | * [行为](aggregation-pipeline-and-sharded-collections.md#behavior) 6 | * [优化](aggregation-pipeline-and-sharded-collections.md#optimization) 7 | 8 | 聚合管道支持对[分片](aggregation-pipeline-and-sharded-collections.md)集合的操作。本节介绍特定于[聚合管道](./)和分片集合的行为。 9 | 10 | ## 行为 11 | 12 | Mongodb 3.2 版本的改变 13 | 14 | 如果管道以 shard key 上的精确[$match](aggregation-pipeline-and-sharded-collections.md)开头,则整个管道仅在匹配的分片上运行。以前,管道将被拆分,合并它的工作必须在主分片上完成。 15 | 16 | 对于必须在多个分片上运行的聚合操作,如果操作不需要在数据库的主分片上运行,则这些操作将会将结果路由到随机分片以合并结果,以避免该数据库的主分片超载。 [$out](aggregation-pipeline-and-sharded-collections.md)阶段和[$lookup](aggregation-pipeline-and-sharded-collections.md)阶段需要在数据库的主分片上运行。 17 | 18 | ## 优化 19 | 20 | 在将聚合管道分成两部分时,管道被拆分以确保分片在考虑优化的情况下执行尽可能多的阶段。 21 | 22 | 要查看管道是如何拆分的,请在[db.collection.aggregate\(\)](aggregation-pipeline-and-sharded-collections.md)方法中包含[explain](aggregation-pipeline-and-sharded-collections.md)选项。 23 | 24 | 优化可能会在不同版本之间发生变化。 25 | 26 | 译者:李冠飞 27 | 28 | 校对:李冠飞 29 | 30 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Update-Operators/Field-Update-Operators.md: -------------------------------------------------------------------------------- 1 | # [ ](#)字段更新运算符 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 8 | 9 | | 名称 | 描述 | 10 | | ------------------ | ------------------------------------------------------------ | 11 | | [`$currentDate`]() | 将字段的值设置为当前日期,即日期或时间戳。 | 12 | | [`$inc`]() | 将字段的值增加指定的数量。 | 13 | | [`$min`]() | 仅当指定值小于现有字段值时才更新该字段。 | 14 | | [`$max`]() | 仅当指定值大于现有字段值时才更新该字段。 | 15 | | [`$mul`]() | 将字段的值乘以指定的数量。 | 16 | | [`$rename`]() | 重命名字段。 | 17 | | [`$set`]() | 设置文档中字段的值。 | 18 | | [`$setOnInsert`]() | 如果更新导致插入文档,则设置字段的值。对修改现有文档的更新操作没有影响。 | 19 | | [`$unset`]() | 从文档中删除指定的字段。 | 20 | 21 | 22 | 23 | 译者:李冠飞 24 | 25 | 校对: -------------------------------------------------------------------------------- /docs/MongoDB-CRUD-Operations/MongoDB-CRUD-Concepts.md: -------------------------------------------------------------------------------- 1 | # MongoDB CRUD 概念 2 | 3 | 本节包含与MongoDB中的CRUD操作相关的其他概念的信息。 4 | 5 | **原子性,一致性和分布式操作** 6 | 7 | - [原子性和事务](https://docs.mongodb.com/manual/core/write-operations-atomicity/) 8 | - [阅读隔离度,一致性和近效性](https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/) 9 | - [分布式查询](https://docs.mongodb.com/manual/core/distributed-queries/) 10 | - [通过findAndModify进行线性化读取](https://docs.mongodb.com/manual/tutorial/perform-findAndModify-linearizable-reads/) 11 | 12 | **查询计划,性能和分析** 13 | 14 | - [查询计划](https://docs.mongodb.com/manual/core/query-plans/) 15 | - [查询优化](https://docs.mongodb.com/manual/core/query-optimization/) 16 | - [分析查询性能](https://docs.mongodb.com/manual/tutorial/analyze-query-plan/) 17 | - [写操作性能](https://docs.mongodb.com/manual/core/write-performance/) 18 | 19 | **其它** 20 | 21 | * [Tailable 游标](https://docs.mongodb.com/manual/core/tailable-cursors/) 22 | 23 | 24 | 25 | 也可以看看: 26 | 27 | [事务](https://docs.mongodb.com/manual/core/transactions/) 28 | 29 | 30 | 31 | 译者:杨帅 32 | 33 | 校对:杨帅 -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/gt.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$gt 2 | 3 | []() 4 | 5 | **$gt** 6 | 7 | *语法*:`{field: {$gt: value} }` 8 | 9 | `$gt`选择的值`field`大于(即`>`)指定的那些文档 `value`。 10 | 11 | 对于大多数数据类型,比较运算符仅对BSON类型与查询值的类型匹配的字段执行比较 。MongoDB通过Type Bracketing支持有限的跨BSON比较。 12 | 13 | 考虑以下示例: 14 | 15 | ```powershell 16 | db.inventory.find( { qty: { $gt: 20 } } ) 17 | ``` 18 | 19 | 此查询将选择`inventory`集合中`qty`字段值大于`20`的所有文档。 20 | 21 | 考虑以下示例,该示例将`$gt`运算符与嵌入式文档中的字段一起使用: 22 | 23 | ```powershell 24 | db.inventory.update( { "carrier.fee": { $gt: 2 } }, { $set: { price: 9.99 } } ) 25 | ``` 26 | 27 | `update()`操作将设置`price`找到的第一个文档中包含嵌入文档`carrier`的`fee`字段的值,该嵌入文档的字段值大于`2`。 28 | 29 | 要`price`在包含嵌入文档的*所有*文档中设置该字段的值,该嵌入文档`carrier`的`fee`字段值大于`2`,请在`update()`方法中指定`multi:true`选项: 30 | 31 | ```powershell 32 | db.inventory.update( 33 | { "carrier.fee": { $gt: 2 } }, 34 | { $set: { price: 9.99 } }, 35 | { multi: true } 36 | ) 37 | ``` 38 | 39 | > **也可以看看** 40 | > 41 | > `find()`,`update()`,`$set`。 42 | 43 | 44 | 45 | 译者:李冠飞 46 | 47 | 校对: -------------------------------------------------------------------------------- /indexes/indexing-strategies/README.md: -------------------------------------------------------------------------------- 1 | # 索引策略 2 | 3 | 应用程序的最佳索引必须考虑许多因素,包括预期的查询类型、读写比率和系统上的空闲内存量。 4 | 5 | 在开发索引策略时,您应该对应用程序的查询有深刻的理解。在构建索引之前,要映射出将要运行的查询类型,以便构建引用这些字段的索引。索引会带来性能成本,但与频繁查询大型数据集的成本相比,它更值得。考虑应用程序中每个查询的相对频率,以及该查询是否适合使用索引。 6 | 7 | 设计索引的最佳总体策略是使用与您将在生产环境中运行的数据集相似的数据集来分析各种索引配置,以查看哪种配置性能最佳。检查为您的集合创建的当前索引,以确保它们支持您当前和计划中的查询。如果不再使用索引,请删除该索引。 8 | 9 | 通常,MongoDB只使用一个索引来完成大多数查询。然而,一个[`$or`](https://docs.mongodb.com/master/reference/operator/query/or/#op._S_or)查询的每个子句可能使用一个不同的索引,此外,MongoDB可以使用多个索引的[交集](https://docs.mongodb.com/master/core/index-intersection/)。 10 | 11 | 下面的文档介绍了索引策略: 12 | 13 | * [创建索引支持查询](create-indexes-to-support-your-queries.md) 14 | 15 | 当索引包含查询扫描的所有字段时,索引就支持查询。创建支持查询的索引可以极大地提高查询性能。 16 | 17 | * [使用索引对查询结果进行排序](use-indexes-to-sort-query-results.md) 18 | 19 | 为了支持高效查询,在指定索引字段的顺序和排序顺序时,请使用这里的策略。 20 | 21 | * [确保索引适合RAM](ensure-indexes-fit-in-ram.md) 22 | 23 | 当索引适合RAM时,系统可以避免从磁盘读取索引,从而获得最快的处理速度。 24 | 25 | * [创建以确保选择性的查询](create-queries-that-ensure-selectivity.md) 26 | 27 | 选择性是指查询使用索引缩小结果的能力。选择性允许MongoDB在与完成查询相关的大部分工作中使用索引。 28 | 29 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/Comparison-Query-Operators/nin.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$nin 2 | 3 | []() 4 | 5 | **$nin** 6 | 7 | *语法*:`{ field: { $nin: [ , ... ]} }` 8 | 9 | `$nin`选择以下位置的文档: 10 | 11 | - 该`field`值不在指定的范围内`array` **或** 12 | - 在`field`不存在。 13 | 14 | 有关不同BSON类型值的比较,请参见指定的BSON比较顺序。 15 | 16 | 考虑以下查询: 17 | 18 | ```powershell 19 | db.inventory.find( { qty: { $nin: [ 5, 15 ] } } ) 20 | ``` 21 | 22 | 这个查询将选择库存集合中`qty`字段值不等于`5`或`15`的所有文档。所选文档将包括那些不包含`qty`字段的文档。 23 | 24 | 如果字段包含数组,那么`$nin`操作符将选择字段中没有元素等于指定数组中的值的文档(例如``, ``,等等)。 25 | 26 | 考虑以下查询: 27 | 28 | ```powershell 29 | db.inventory.update( { tags: { $nin: [ "appliances", "school" ] } }, { $set: { sale: false } } ) 30 | ``` 31 | 32 | 这个`update()`操作将设置库存集合中的`sale`字段值,其中,`tags`字段包含一个数组,数组中没有与数组`["appliances", "school"]`中的元素匹配的元素,或者文档不包含`tags`字段。 33 | 34 | 不等运算符`$nin`的选择性不是很强,因为它经常匹配索引的很大一部分。因此,在许多情况下,带有索引的`$nin`查询的性能可能不比必须扫描集合中所有文档的`$nin`查询好。请参见查询选择性。 35 | 36 | > **也可以看看** 37 | > 38 | > `find()`,`update()`,`$set`。 39 | 40 | 41 | 42 | 译者:李冠飞 43 | 44 | 校对: -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-getindexes.md: -------------------------------------------------------------------------------- 1 | # db.collection.getIndexes\(\) 2 | 3 | 在本页面 4 | 5 | * [定义](db-collection-getindexes.md#definition) 6 | * [行为](db-collection-getindexes.md#behavior) 7 | * [必需的访问权](db-collection-getindexes.md#required-access) 8 | * [输出](db-collection-getindexes.md#output) 9 | 10 | ## 定义 11 | 12 | * `db.collection.` `getIndexes` \(\) 13 | 14 | 返回一个 array,其中包含用于标识和描述集合上现有索引的文档列表。您必须在集合上调用db.collection.getIndexes\(\)。例如: 15 | 16 | ```text 17 | db.collection.getIndexes() 18 | ``` 19 | 20 | 将`collection`更改为要为其返回索引信息的集合的 name。 21 | 22 | ## 行为 23 | 24 | 从MongoDB 4.2开始,如果发出`db.collection.getIndexes()`断开连接的客户端在操作完成之前断开连接,则MongoDB将标记`db.collection.getIndexes()`为终止(即`killOp`在操作上)。 25 | 26 | ## 必需的访问权 27 | 28 | 要`db.collection.getIndexes()`在强制执行访问控制时运行,使用者必须`listIndexes`对该集合具有访问权限。 29 | 30 | 内置角色`read`提供了`db.collection.getIndexes()`为数据库中的集合运行所需的特权。 31 | 32 | ## 输出 33 | 34 | db.collection.getIndexes\(\)返回包含集合索引信息的 array 文档。索引信息包括用于创建索引的键和选项。有关键和索引选项的信息,请参阅db.collection.createIndex\(\)。 35 | 36 | 译者:李冠飞 37 | 38 | 校对: 39 | 40 | -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Role-Management-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)角色管理命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | ------------------------------ | ---------------------------------------------- | 11 | | [`createRole`]() | 创建一个角色并指定其特权。 | 12 | | [`dropRole`]() | 删除用户定义的角色。 | 13 | | [`dropAllRolesFromDatabase`]() | 从数据库中删除所有用户定义的角色。 | 14 | | [`grantPrivilegesToRole`]() | 将特权分配给用户定义的角色。 | 15 | | [`grantRolesToRole`]() | 指定角色,用户定义的角色将从这些角色继承特权。 | 16 | | [`invalidateUserCache`]() | 刷新用户信息的内存缓存,包括凭据和角色。 | 17 | | [`revokePrivilegesFromRole`]() | 从用户定义的角色中删除指定的特权。 | 18 | | [`revokeRolesFromRole`]() | 从用户定义的角色中删除指定的继承角色。 | 19 | | [`rolesInfo`]() | 返回指定角色的信息。 | 20 | | [`updateRole`]() | 更新用户定义的角色。 | 21 | 22 | 23 | 24 | 译者:李冠飞 25 | 26 | 校对: -------------------------------------------------------------------------------- /install-mongodb/install-mongodb-enterprise/install-on-linux-enterprise.md: -------------------------------------------------------------------------------- 1 | # 在Linux上安装MongoDB企业版 2 | 3 | 此文档提供了为受支持的Linux系统安装MongoDB企业版的说明。 4 | 5 | * [在Red Hat上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-red-hat/) 6 | 7 | 使用软件包在Red Hat Enterprise或CentOS系统上安装MongoDB企业版和必需的依赖项。 8 | 9 | * [在Ubuntu上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-ubuntu/) 10 | 11 | 使用软件包在Ubuntu Linux系统上安装MongoDB企业版和必需的依赖项。 12 | 13 | * [在Debian上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-debian/) 14 | 15 | 使用软件包在Debian Linux系统上安装MongoDB企业版和必需的依赖项。 16 | 17 | * [在SUSE上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-suse/) 18 | 19 | 在SUSE Enterprise Linux上安装MongoDB企业版和必需的依赖项。 20 | 21 | * [在亚马逊上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-amazon/) 22 | 23 | 在Amazon Linux AMI上安装MongoDB企业版和必需的依赖项。 24 | 25 | 原文链接:[https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/](https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/) 26 | 27 | 译者:小芒果 28 | 29 | -------------------------------------------------------------------------------- /aggregation/aggregation-reference/aggregation-commands.md: -------------------------------------------------------------------------------- 1 | # 聚合命令 2 | 3 | 在本页面 4 | 5 | * [聚合命令](aggregation-commands.md#id1) 6 | * [聚合方法](aggregation-commands.md#aggregation-methods) 7 | 8 | > **\[success\] 注意** 9 | > 10 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定的运算符以转到其参考页面。 11 | 12 | ## 聚合命令 13 | 14 | | 名称 | 描述 | 15 | | :--- | :--- | 16 | | [aggregate](aggregation-commands.md) | 使用聚合框架执行聚合任务,例如 group。 | 17 | | [count](aggregation-commands.md) | 计算集合或视图中的文档数。 | 18 | | [distinct](aggregation-commands.md) | 显示在集合或视图中为指定 key 找到的不同值。 | 19 | | [mapReduce](aggregation-commands.md) | 对大型数据集执行[map-reduce](../map-reduce/)聚合。 | 20 | 21 | ## 聚合方法 22 | 23 | | 名称 | 描述 | 24 | | :--- | :--- | 25 | | [db.collection.aggregate\(\)](../../can-kao/mongo-shell-methods/collection-methods/db-collection-aggregate.md) | 提供对[聚合管道](../aggregation-pipeline/)的访问。 | 26 | | [db.collection.mapReduce\(\)](https://github.com/mongodb-china/MongoDB-CN-Manual/tree/8490376c81d56eff95abbaddc6ee414b1e1c9705/docs/docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-mapReduce.md) | 对大型数据集执行[map-reduce](../map-reduce/)聚合。 | 27 | 28 | 译者:李冠飞 29 | 30 | 校对:李冠飞 31 | 32 | -------------------------------------------------------------------------------- /docs/Indexes/Indexing-Strategies.md: -------------------------------------------------------------------------------- 1 | ## 索引策略 2 | 3 | 应用程序的最佳索引必须考虑许多因素,包括预期的查询类型、读写比率和系统上的空闲内存量。 4 | 5 | 在开发索引策略时,您应该对应用程序的查询有深刻的理解。在构建索引之前,要映射出将要运行的查询类型,以便构建引用这些字段的索引。索引会带来性能成本,但与频繁查询大型数据集的成本相比,它更值得。考虑应用程序中每个查询的相对频率,以及该查询是否适合使用索引。 6 | 7 | 设计索引的最佳总体策略是使用与您将在生产环境中运行的数据集相似的数据集来分析各种索引配置,以查看哪种配置性能最佳。检查为您的集合创建的当前索引,以确保它们支持您当前和计划中的查询。如果不再使用索引,请删除该索引。 8 | 9 | 通常,MongoDB只使用一个索引来完成大多数查询。然而,一个[`$or`](https://docs.mongodb.com/master/reference/operator/query/or/#op._S_or)查询的每个子句可能使用一个不同的索引,此外,MongoDB可以使用多个索引的[交集](https://docs.mongodb.com/master/core/index-intersection/)。 10 | 11 | 下面的文档介绍了索引策略: 12 | 13 | - [创建索引支持查询](./Indexing-Strategies/Create-Indexes-to-Support-Your-Queries.md) 14 | 15 | 当索引包含查询扫描的所有字段时,索引就支持查询。创建支持查询的索引可以极大地提高查询性能。 16 | 17 | - [使用索引对查询结果进行排序](./Indexing-Strategies/Use-Indexes-to-Sort-Query-Results.md) 18 | 19 | 为了支持高效查询,在指定索引字段的顺序和排序顺序时,请使用这里的策略。 20 | 21 | - [确保索引适合RAM](./Indexing-Strategies/Ensure-Indexes-Fit-in-RAM.md) 22 | 23 | 当索引适合RAM时,系统可以避免从磁盘读取索引,从而获得最快的处理速度。 24 | 25 | - [创建以确保选择性的查询](./Indexing-Strategies/Create-Queries-that-Ensure-Selectivity.md) 26 | 27 | 选择性是指查询使用索引缩小结果的能力。选择性允许MongoDB在与完成查询相关的大部分工作中使用索引。 -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-getIndexes.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.getIndexes() 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [定义](#definition) 8 | 9 | * [行为](#behavior) 10 | 11 | * [必需的访问权](#required-access) 12 | 13 | * [输出](#output) 14 | 15 | ## 定义 16 | 17 | * `db.collection.` `getIndexes` () 18 | 19 | 返回一个 array,其中包含用于标识和描述集合上现有索引的文档列表。您必须在集合上调用db.collection.getIndexes()。例如: 20 | 21 | ```powershell 22 | db.collection.getIndexes() 23 | ``` 24 | 25 | 将`collection`更改为要为其返回索引信息的集合的 name。 26 | 27 | ## 行为 28 | 29 | 从MongoDB 4.2开始,如果发出`db.collection.getIndexes()`断开连接的客户端在操作完成之前断开连接,则MongoDB将标记`db.collection.getIndexes()`为终止(即`killOp`在操作上)。 30 | 31 | ## 必需的访问权 32 | 33 | 要`db.collection.getIndexes()`在强制执行访问控制时运行,使用者必须`listIndexes`对该集合具有访问权限。 34 | 35 | 内置角色`read`提供了`db.collection.getIndexes()`为数据库中的集合运行所需的特权。 36 | 37 | ## 输出 38 | 39 | db.collection.getIndexes()返回包含集合索引信息的 array 文档。索引信息包括用于创建索引的键和选项。有关键和索引选项的信息,请参阅db.collection.createIndex()。 40 | 41 | 42 | 43 | 译者:李冠飞 44 | 45 | 校对: -------------------------------------------------------------------------------- /can-kao/shu-ju-ku-ming-ling/replication-commands.md: -------------------------------------------------------------------------------- 1 | # 复制命令 2 | 3 | > **注意** 4 | > 5 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 6 | 7 | | 名称 | 描述 | 8 | | :--- | :--- | 9 | | [`applyOps`](replication-commands.md) | 应用于内部命令OPLOG条目到当前数据集。 | 10 | | [`isMaster`](replication-commands.md) | 显示有关此成员在副本集中的角色的信息,包括它是否为主角色。 | 11 | | [`replSetAbortPrimaryCatchUp`](replication-commands.md) | 强制选择的主数据库中止同步(追赶),然后完成到主数据库的过渡。 | 12 | | [`replSetFreeze`](replication-commands.md) | 防止当前成员在一段时间内寻求选举为主。 | 13 | | [`replSetGetConfig`](replication-commands.md) | 返回副本集的配置对象。 | 14 | | [`replSetGetStatus`](replication-commands.md) | 返回报告副本集状态的文档。 | 15 | | [`replSetInitiate`](replication-commands.md) | 初始化新的副本集。 | 16 | | [`replSetMaintenance`](replication-commands.md) | 启用或禁用维护模式,该模式将辅助节点置于一种`RECOVERING`状态。 | 17 | | [`replSetReconfig`](replication-commands.md) | 将新配置应用于现有副本集。 | 18 | | [`replSetResizeOplog`](replication-commands.md) | 动态调整副本集成员的操作日志的大小。仅适用于WiredTiger存储引擎。 | 19 | | [`replSetStepDown`](replication-commands.md) | 当前`primary`下台,成为一个`secondary`,迫使选举。 | 20 | | [`replSetSyncFrom`](replication-commands.md) | 显式覆盖用于选择要复制的成员的默认逻辑。 | 21 | 22 | 译者:李冠飞 23 | 24 | 校对: 25 | 26 | -------------------------------------------------------------------------------- /docs/Install-MongoDB/Install-on-Linux.md: -------------------------------------------------------------------------------- 1 | # 在Linux上安装MongoDB社区版 2 | 3 | 这些文档提供了为受支持的Linux系统安装MongoDB社区版的说明。 4 | 5 | 6 | 7 | ## 推荐 8 | 9 | 为了获得最佳的安装体验,MongoDB提供了适用于流行Linux发行版的软件包。这些软件包是运行MongoDB的首选方式。以下指南详细介绍了这些系统的安装过程: 10 | 11 | - [在Red Hat上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-red-hat/) 12 | 13 | 使用`.rpm`软件包在Red Hat企业版和相关Linux系统上安装MongoDB社区版。 14 | 15 | - [在Ubuntu上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-ubuntu/) 16 | 17 | 使用`.deb`软件包在Ubuntu Linux系统上安装MongoDB社区版。 18 | 19 | - [在Debian上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-debian/) 20 | 21 | 使用`.deb` 软件包在Debian系统上安装MongoDB社区版。 22 | 23 | - [在SUSE上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-suse/) 24 | 25 | 使用`.rpm`软件包在SUSE Linux系统上安装MongoDB Community Edition 。 26 | 27 | - [在亚马逊上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-amazon/) 28 | 29 | 使用`.rpm`软件包在Amazon Linux AMI系统上安装MongoDB社区版。 30 | 31 | WINDOWS LINUX子系统(WSL)-不支持 32 | 33 | MongoDB不支持Linux的Windows子系统(WSL)。 34 | 35 | 36 | 37 | 原文链接:https://docs.mongodb.com/v4.2/administration/install-on-linux/ 38 | 39 | 译者:小芒果 -------------------------------------------------------------------------------- /can-kao/default-mongodb-port.md: -------------------------------------------------------------------------------- 1 | # 默认的MongoDB端口 2 | 3 | 下表列出了MongoDB使用的默认TCP端口: 4 | 5 | | Default Port | Description | 6 | | :--- | :--- | 7 | | `27017` | [`mongod`](https://docs.mongodb.com/master/reference/program/mongod/#bin.mongod)和[`mongos`](https://docs.mongodb.com/master/reference/program/mongos/#bin.mongos)实例的默认端口。您可以使用[`port`](https://docs.mongodb.com/master/reference/configuring-options/#net.port)或[`——port`](https://docs.mongodb.com/master/reference/program/mongod/#%20cmdop-mongod%20-port)来更改该端口。 | 8 | | `27018` | 默认端口为[`mongod`](https://docs.mongodb.com/master/reference/program/mongod/%20bin.mongod)运行[**——shardsvr**](https://docs.mongodb.com/master/reference/program/mongod/%20#%20cmdoption-mongod-shardsvr)命令行选项或 **shardsvr** 值[**clusterRole**](https://docs.mongodb.com/master/reference/configuration-options/%20#%20sharding.clusterRole)设置在配置文件中。 | 9 | | `27019` | 默认端口为[`mongod`](https://docs.mongodb.com/master/reference/program/mongod/%20bin.mongod)运行[**——configsvr**](https://docs.mongodb.com/master/reference/program/mongod/%20#%20cmdoption-mongod-configsvr)命令行选项或 **configsvr** 值[**clusterRole**](https://docs.mongodb.com/master/reference/configuration-options/%20#%20sharding.clusterRole)设置在配置文件中。 | 10 | 11 | -------------------------------------------------------------------------------- /install-mongodb/install-mongodb-community-edition/install-on-linux.md: -------------------------------------------------------------------------------- 1 | # 在Linux上安装MongoDB社区版 2 | 3 | 这些文档提供了为受支持的Linux系统安装MongoDB社区版的说明。 4 | 5 | ## 推荐 6 | 7 | 为了获得最佳的安装体验,MongoDB提供了适用于流行Linux发行版的软件包。这些软件包是运行MongoDB的首选方式。以下指南详细介绍了这些系统的安装过程: 8 | 9 | * [在Red Hat上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-red-hat/) 10 | 11 | 使用`.rpm`软件包在Red Hat企业版和相关Linux系统上安装MongoDB社区版。 12 | 13 | * [在Ubuntu上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-ubuntu/) 14 | 15 | 使用`.deb`软件包在Ubuntu Linux系统上安装MongoDB社区版。 16 | 17 | * [在Debian上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-debian/) 18 | 19 | 使用`.deb` 软件包在Debian系统上安装MongoDB社区版。 20 | 21 | * [在SUSE上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-suse/) 22 | 23 | 使用`.rpm`软件包在SUSE Linux系统上安装MongoDB Community Edition 。 24 | 25 | * [在亚马逊上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-amazon/) 26 | 27 | 使用`.rpm`软件包在Amazon Linux AMI系统上安装MongoDB社区版。 28 | 29 | WINDOWS LINUX子系统(WSL)-不支持 30 | 31 | MongoDB不支持Linux的Windows子系统(WSL)。 32 | 33 | 原文链接:[https://docs.mongodb.com/v4.2/administration/install-on-linux/](https://docs.mongodb.com/v4.2/administration/install-on-linux/) 34 | 35 | 译者:小芒果 36 | 37 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-and-projection-operators/comment.md: -------------------------------------------------------------------------------- 1 | # $comment 2 | 3 | 在本页面 4 | 5 | * [定义](comment.md#definition) 6 | * [行为](comment.md#behavior) 7 | * [例子](comment.md#example) 8 | 9 | ## 定义 10 | 11 | **$comment** 12 | 13 | `$comment`查询操作符将注释与任何具有查询谓词的表达式关联起来。 14 | 15 | 由于注释会传播到`profile`日志,因此添加注释可以使您的个人资料数据更易于解释和跟踪。 16 | 17 | `$comment`运算符的形式为: 18 | 19 | ```text 20 | db.collection.find( { , $comment: } ) 21 | ``` 22 | 23 | ## 行为 24 | 25 | 您可以将\_ `$comment`与任何带查询谓词的表达式一起使用,例如聚合管道中`db.collection.update()`或聚合`$match`阶段中的查询谓词 。有关示例,请参见对聚合表达式附加注释。 26 | 27 | ## 例子 28 | 29 | ### 附加评论到`find` 30 | 31 | 以下示例`$comment`在 `find()`操作中添加了: 32 | 33 | ```text 34 | db.records.find( 35 | { 36 | x: { $mod: [ 2, 0 ] }, 37 | $comment: "Find even values." 38 | } 39 | ) 40 | ``` 41 | 42 | ### 在聚合表达式上附加注释 43 | 44 | 您可以对`$comment`带查询谓词的任何表达式使用。 45 | 46 | 以下示例在`$match`阶段中使用运算符`$comment`来阐明操作: 47 | 48 | ```text 49 | db.records.aggregate( [ 50 | { $match: { x: { $gt: 0 }, $comment: "Don't allow negative inputs." } }, 51 | { $group : { _id: { $mod: [ "$x", 2 ] }, total: { $sum: "$x" } } } 52 | ] ) 53 | ``` 54 | 55 | > **也可以看看** 56 | > 57 | > `$comment` 58 | 59 | 译者:李冠飞 60 | 61 | 校对: 62 | 63 | -------------------------------------------------------------------------------- /docs/Indexes/Indexing-Strategies/Ensure-Indexes-Fit-in-RAM.md: -------------------------------------------------------------------------------- 1 | ## 确保索引适合RAM 2 | 3 | **在本页面** 4 | 5 | - [仅在RAM中保存最近值的索引](#索引) 6 | 7 | 为了实现最快的处理,请确保索引完全适合RAM,以便系统可以避免从磁盘读取索引。 8 | 9 | 要检查索引的大小,使用[ db.collection.totalIndexSize() ](https://docs.mongodb.com/master/reference/method/db.collection.totalIndexSize/#db.collection.totalIndexSize)帮助器,该帮助程序以字节为单位返回数据: 10 | 11 | ```powershell 12 | > db.collection.totalIndexSize() 13 | 4294976499 14 | ``` 15 | 16 | 上面的示例显示了一个接近4.3GB的索引大小。为了确保该索引适合RAM,您不仅必须拥有多于该数量的可用RAM,而且还必须为其余[工作集](https://docs.mongodb.com/master/reference/glossary/#term-working-set)提供RAM 。还请记住: 17 | 18 | 如果您拥有并使用多个集合,则必须考虑所有集合上所有索引的大小。索引和工作集必须能够同时装入内存。 19 | 20 | 在一些有限的情况下,索引不需要装入内存。参见[只在RAM中保存最近值的索引](https://docs.mongodb.com/master/tutorial/ensureindexes-fit-ram/#indexing-right -handed)。 21 | 22 | 也可以看看: 23 | 24 | [`collStats`](https://docs.mongodb.com/master/reference/command/collStats/#dbcmd.collStats) 和 [`db.collection.stats()`](https://docs.mongodb.com/master/reference/method/db.collection.stats/#db.collection.stats) 25 | 26 | 27 | 28 | ### 仅在RAM中保存最近值的索引 29 | 30 | 索引不必在所有情况下都完全适合RAM。如果索引字段的值随每次插入而增加,并且大多数查询选择最近添加的文档;那么MongoDB只需要将索引中保留最新或“最右边”值的部分保留在RAM中。这样可以有效地将索引用于读取和写入操作,并最大程度地减少支持索引所需的RAM数量。 -------------------------------------------------------------------------------- /indexes/indexing-strategies/ensure-indexes-fit-in-ram.md: -------------------------------------------------------------------------------- 1 | # 确保索引适合RAM 2 | 3 | **在本页面** 4 | 5 | * [仅在RAM中保存最近值的索引](ensure-indexes-fit-in-ram.md#索引) 6 | 7 | 为了实现最快的处理,请确保索引完全适合RAM,以便系统可以避免从磁盘读取索引。 8 | 9 | 要检查索引的大小,使用[ db.collection.totalIndexSize\(\) ](https://docs.mongodb.com/master/reference/method/db.collection.totalIndexSize/#db.collection.totalIndexSize)帮助器,该帮助程序以字节为单位返回数据: 10 | 11 | ```text 12 | > db.collection.totalIndexSize() 13 | 4294976499 14 | ``` 15 | 16 | 上面的示例显示了一个接近4.3GB的索引大小。为了确保该索引适合RAM,您不仅必须拥有多于该数量的可用RAM,而且还必须为其余[工作集](https://docs.mongodb.com/master/reference/glossary/#term-working-set)提供RAM 。还请记住: 17 | 18 | 如果您拥有并使用多个集合,则必须考虑所有集合上所有索引的大小。索引和工作集必须能够同时装入内存。 19 | 20 | 在一些有限的情况下,索引不需要装入内存。参见[只在RAM中保存最近值的索引](https://docs.mongodb.com/master/tutorial/ensureindexes-fit-ram/#indexing-right%20-handed)。 21 | 22 | 也可以看看: 23 | 24 | [`collStats`](https://docs.mongodb.com/master/reference/command/collStats/#dbcmd.collStats) 和 [`db.collection.stats()`](https://docs.mongodb.com/master/reference/method/db.collection.stats/#db.collection.stats) 25 | 26 | ## 仅在RAM中保存最近值的索引 27 | 28 | 索引不必在所有情况下都完全适合RAM。如果索引字段的值随每次插入而增加,并且大多数查询选择最近添加的文档;那么MongoDB只需要将索引中保留最新或“最右边”值的部分保留在RAM中。这样可以有效地将索引用于读取和写入操作,并最大程度地减少支持索引所需的RAM数量。 29 | 30 | -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-copyto.md: -------------------------------------------------------------------------------- 1 | # db.collection.copyTo\(\) 2 | 3 | 在本页面 4 | 5 | * [定义](db-collection-copyto.md#definition) 6 | * [行为](db-collection-copyto.md#behavior) 7 | * [例子](db-collection-copyto.md#examples) 8 | 9 | ## 定义 10 | 11 | * `db.collection.` `copyTo`\(newCollection\) 12 | * 自 version 3.0 以来已弃用。 13 | 14 | 使用 server-side JavaScript 将`collection`中的所有文档复制到`newCollection`。如果`newCollection`不存在,MongoDB 会创建它。 15 | 16 | 如果启用了授权,则必须能够访问 order run db.collection.copyTo\(\)中所有资源的所有操作。建议不要提供此类访问权限,但如果您的组织要求用户 run db.collection.copyTo\(\),请创建一个在anyResource上授予anyAction的角色。不要将此角色分配给任何其他用户。 17 | 18 | | 参数 | 类型 | 描述 | 19 | | :--- | :--- | :--- | 20 | | `newCollection` | string | 要将数据写入的集合的 name。 | 21 | 22 | > **警告** 23 | > 24 | > 使用 db.collection.copyTo\(\)检查字段类型时,确保操作不会在从 BSON 转换为 JSON 期间从文档中删除类型信息。 db.collection.copyTo\(\)方法在内部使用EVAL命令。因此,db.collection.copyTo\(\)操作采用 global 锁定,阻止所有其他读取和写入操作,直到db.collection.copyTo\(\)完成。 25 | 26 | copyTo\(\)返回复制的文档数。如果复制失败,则抛出 exception。 27 | 28 | ## 行为 29 | 30 | 因为copyTo\(\)在内部使用EVAL,所以复制操作将阻止mongod实例上的所有其他操作。 31 | 32 | ## 例子 33 | 34 | 以下操作将`source`集合中的所有文档复制到`target`集合中。 35 | 36 | ```text 37 | db.source.copyTo(target) 38 | ``` 39 | 40 | 译者:李冠飞 41 | 42 | 校对: 43 | 44 | -------------------------------------------------------------------------------- /docs/Install-MongoDB/Install-MongoDB-Enterprise.md: -------------------------------------------------------------------------------- 1 | # 安装MongoDB企业版 2 | 3 | 这些文档提供了安装MongoDB企业版的说明。 4 | 5 | MongoDB企业版可供MongoDB企业版订户使用,并包括其他一些功能,包括对SNMP监视,LDAP身份验证,Kerberos身份验证和系统事件审核的支持。 6 | 7 | 8 | 9 | 注意 10 | 11 | 由于[SERVER-29352](https://jira.mongodb.org/browse/SERVER-29352),macOS上的MongoDB Enterprise *不*包括对SNMP的支持。 12 | 13 | - [在Linux上安装](https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/) 14 | 15 | 在基于Linux的系统上安装MongoDB企业版的正式版本。 16 | 17 | - [在macOS上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-os-x/) 18 | 19 | 在macOS上安装MongoDB企业版的正式版本 20 | 21 | - [在Windows上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-windows/) 22 | 23 | 使用`.msi` 安装程序在Windows上安装MongoDB企业版。 24 | 25 | - [使用Docker安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-with-docker/) 26 | 27 | 安装MongoDB企业版Docker容器。 28 | 29 | ← [使用msiexec.exe在Windows上安装MongoDB社区](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-windows-unattended/)[在Linux上安装MongoDB Enterprise](https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/) → 30 | 31 | 32 | 33 | 原文链接:https://docs.mongodb.com/v4.2/administration/install-enterprise/ 34 | 35 | 译者:小芒果 36 | -------------------------------------------------------------------------------- /install-mongodb/install-mongodb-enterprise/README.md: -------------------------------------------------------------------------------- 1 | # 安装MongoDB企业版 2 | 3 | 这些文档提供了安装MongoDB企业版的说明。 4 | 5 | MongoDB企业版可供MongoDB企业版订户使用,并包括其他一些功能,包括对SNMP监视,LDAP身份验证,Kerberos身份验证和系统事件审核的支持。 6 | 7 | 注意 8 | 9 | 由于[SERVER-29352](https://jira.mongodb.org/browse/SERVER-29352),macOS上的MongoDB Enterprise _不_包括对SNMP的支持。 10 | 11 | * [在Linux上安装](https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/) 12 | 13 | 在基于Linux的系统上安装MongoDB企业版的正式版本。 14 | 15 | * [在macOS上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-os-x/) 16 | 17 | 在macOS上安装MongoDB企业版的正式版本 18 | 19 | * [在Windows上安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-on-windows/) 20 | 21 | 使用`.msi` 安装程序在Windows上安装MongoDB企业版。 22 | 23 | * [使用Docker安装](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-enterprise-with-docker/) 24 | 25 | 安装MongoDB企业版Docker容器。 26 | 27 | ← [使用msiexec.exe在Windows上安装MongoDB社区](https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-windows-unattended/)[在Linux上安装MongoDB Enterprise](https://docs.mongodb.com/v4.2/administration/install-enterprise-linux/) → 28 | 29 | 原文链接:[https://docs.mongodb.com/v4.2/administration/install-enterprise/](https://docs.mongodb.com/v4.2/administration/install-enterprise/) 30 | 31 | 译者:小芒果 32 | 33 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/aggregation-pipeline-operators/concat-aggregation.md: -------------------------------------------------------------------------------- 1 | # $concat \(aggregation\) 2 | 3 | 在本页面 4 | 5 | * [定义](concat-aggregation.md#definition) 6 | * [例子](concat-aggregation.md#example) 7 | 8 | ## 定义 9 | 10 | **$concat** 11 | 12 | 连接字符串并返回连接的字符串。 13 | 14 | `$concat`具有以下语法: 15 | 16 | ```text 17 | { $concat: [ , , ... ] } 18 | ``` 19 | 20 | 参数可以解析为字符串,可以是任何有效的表达式。有关表达式的更多信息,请参见 表达式。 21 | 22 | 如果参数解析为的值`null`或指向缺少的字段,则`$concat`返回`null`。 23 | 24 | ## 例子 25 | 26 | 考虑`inventory`包含以下文档的集合: 27 | 28 | ```text 29 | { "_id" : 1, "item" : "ABC1", quarter: "13Q1", "description" : "product 1" } 30 | { "_id" : 2, "item" : "ABC2", quarter: "13Q4", "description" : "product 2" } 31 | { "_id" : 3, "item" : "XYZ1", quarter: "14Q2", "description" : null } 32 | ``` 33 | 34 | 以下操作使用`$concat`运算符将`item`字段和`description`带有“-”定界符的字段连接起来。 35 | 36 | ```text 37 | db.inventory.aggregate( 38 | [ 39 | { $project: { itemDescription: { $concat: [ "$item", " - ", "$description" ] } } } 40 | ] 41 | ) 42 | ``` 43 | 44 | 该操作返回以下结果: 45 | 46 | ```text 47 | { "_id" : 1, "itemDescription" : "ABC1 - product 1" } 48 | { "_id" : 2, "itemDescription" : "ABC2 - product 2" } 49 | { "_id" : 3, "itemDescription" : null } 50 | ``` 51 | 52 | 译者:李冠飞 53 | 54 | 校对: 55 | 56 | -------------------------------------------------------------------------------- /docs/MongoDB-CRUD-Operations/Text-Search/Text-Search-Languages.md: -------------------------------------------------------------------------------- 1 | 2 | # 文本搜索语言 3 | [文本索引](https://docs.mongodb.com/master/core/index-text/#index-feature-text) 和[`$text`](https://docs.mongodb.com/master/reference/operator/query/text/#op._S_text) 运算符可用于下列语言,并接受两个字母的ISO 639-1语言代码或语言名称的长形式: 4 | 5 | | 语言名称 | ISO 639-1(双字母代码) | 6 | | :----------- | :-------------------- | 7 | | `danish` | `da` | 8 | | `dutch` | `nl` | 9 | | `english` | `en` | 10 | | `finnish` | `fi` | 11 | | `french` | `fr` | 12 | | `german` | `de` | 13 | | `hungarian` | `hu` | 14 | | `italian` | `it` | 15 | | `norwegian` | `nb` | 16 | | `portuguese` | `pt` | 17 | | `romanian` | `ro` | 18 | | `russian` | `ru` | 19 | | `spanish` | `es` | 20 | | `swedish` | `sv` | 21 | | `turkish` | `tr` | 22 | 23 | > **[success] Note** 24 | > 25 | > 如果指定语言值为**“none”**,则文本搜索使用简单的标记化,不包含停止词列表和词干分析。 26 | 27 | 另看: 28 | 29 | [Specify a Language for Text Index](https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/) 30 | 31 | 32 | 译者:杨帅 33 | 34 | 校对:杨帅 -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/aggregation-pipeline-operators/abs-aggregation.md: -------------------------------------------------------------------------------- 1 | # $abs \(aggregation\) 2 | 3 | 在本页面 4 | 5 | * [定义](abs-aggregation.md#definition) 6 | * [行为](abs-aggregation.md#behavior) 7 | * [例子](abs-aggregation.md#example) 8 | 9 | ## 定义 10 | 11 | **$abs** 12 | 13 | version 3.2 中的新内容。 14 | 15 | 返回数字的绝对 value。 16 | 17 | `$abs`具有以下语法: 18 | 19 | ```text 20 | { $abs: } 21 | ``` 22 | 23 | ``表达式可以是任何有效的表达,因为它解析为数字。有关表达式的更多信息,请参阅表达式。 24 | 25 | ## 行为 26 | 27 | 如果参数解析为的值或引用缺少的字段,则`$abs`返回`null`。如果参数解析为`NaN`,则`$abs`返回`NaN`。 28 | 29 | | 例子 | 结果 | 30 | | :--- | :--- | 31 | | `{ $abs: -1 }` | `1` | 32 | | `{ $abs: 1 }` | `1` | 33 | | `{ $abs: null }` | `null` | 34 | 35 | ## 例子 36 | 37 | 集合`ratings`包含以下文档: 38 | 39 | ```text 40 | { _id: 1, start: 5, end: 8 } 41 | { _id: 2, start: 4, end: 4 } 42 | { _id: 3, start: 9, end: 7 } 43 | { _id: 4, start: 6, end: 7 } 44 | ``` 45 | 46 | 以下 example 计算`start`和`end`评级之间的差异大小: 47 | 48 | ```text 49 | db.ratings.aggregate([ 50 | { 51 | $project: { delta: { $abs: { $subtract: [ "$start", "$end" ] } } } 52 | } 53 | ]) 54 | ``` 55 | 56 | 该操作返回以下结果: 57 | 58 | ```text 59 | { "_id" : 1, "delta" : 3 } 60 | { "_id" : 2, "delta" : 0 } 61 | { "_id" : 3, "delta" : 2 } 62 | { "_id" : 4, "delta" : 1 } 63 | ``` 64 | 65 | 译者:李冠飞 66 | 67 | 校对: 68 | 69 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/update-operators/array-update-operators.md: -------------------------------------------------------------------------------- 1 | # 数组更新运算符 2 | 3 | 在本页面 4 | 5 | * [更新运算符](array-update-operators.md#update-operators) 6 | * [更新运算符修饰符](array-update-operators.md#update-operator-modifiers) 7 | 8 | > **注意** 9 | > 10 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。 11 | 12 | ## 更新运算符 13 | 14 | | 名称 | 描述 | 15 | | :--- | :--- | 16 | | [`$`](array-update-operators.md) | 充当占位符,以更新与查询条件匹配的第一个元素。 | 17 | | [`$[]`](array-update-operators.md) | 充当占位符,以更新匹配查询条件的文档的数组中的所有元素。 | 18 | | [`$[]`](array-update-operators.md) | 充当占位符,以更新`arrayFilters`与查询条件匹配的文档中所有与条件匹配的元素。 | 19 | | [`$addToSet`](array-update-operators.md) | 仅当元素不存在于集合中时才将它们添加到数组中。 | 20 | | [`$pop`](array-update-operators.md) | 删除数组的第一项或最后一项。 | 21 | | [`$pull`](array-update-operators.md) | 删除与指定查询匹配的所有数组元素。 | 22 | | [`$push`](array-update-operators.md) | 将项目添加到数组。 | 23 | | [`$pullAll`](array-update-operators.md) | 从数组中删除所有匹配的值。 | 24 | 25 | ## 更新运算符修饰符 26 | 27 | | 名称 | 描述 | 28 | | :--- | :--- | 29 | | [`$each`](array-update-operators.md) | 修改`$push`和`$addToSet`运算符以附加多个项以进行数组更新。 | 30 | | [`$position`](array-update-operators.md) | 修改`$push`运算符以指定要添加元素的数组中的位置。 | 31 | | [`$slice`](array-update-operators.md) | 修改`$push`运算符以限制更新数组的大小。 | 32 | | [`$sort`](array-update-operators.md) | 修改`$push`运算符以对存储在数组中的文档重新排序。 | 33 | 34 | 译者:李冠飞 35 | 36 | 校对: 37 | 38 | -------------------------------------------------------------------------------- /docs/Reference/Default-MongoDB-Port.md: -------------------------------------------------------------------------------- 1 | ## 默认的MongoDB端口 2 | 3 | 下表列出了MongoDB使用的默认TCP端口: 4 | 5 | | Default Port | Description | 6 | | ------------ | ------------------------------------------------------------ | 7 | | `27017` | [` mongod `](https://docs.mongodb.com/master/reference/program/mongod/#bin.mongod)和[` mongos `](https://docs.mongodb.com/master/reference/program/mongos/#bin.mongos)实例的默认端口。您可以使用[` port `](https://docs.mongodb.com/master/reference/configuring-options/#net.port)或[`——port `](https://docs.mongodb.com/master/reference/program/mongod/# cmdop-mongod -port)来更改该端口。 | 8 | | `27018` | 默认端口为[` mongod `](https://docs.mongodb.com/master/reference/program/mongod/ bin.mongod)运行[**——shardsvr**](https://docs.mongodb.com/master/reference/program/mongod/ # cmdoption-mongod-shardsvr)命令行选项或 **shardsvr** 值[**clusterRole**](https://docs.mongodb.com/master/reference/configuration-options/ # sharding.clusterRole)设置在配置文件中。 | 9 | | `27019` | 默认端口为[`mongod `](https://docs.mongodb.com/master/reference/program/mongod/ bin.mongod)运行[**——configsvr**](https://docs.mongodb.com/master/reference/program/mongod/ # cmdoption-mongod-configsvr)命令行选项或 **configsvr** 值[**clusterRole**](https://docs.mongodb.com/master/reference/configuration-options/ # sharding.clusterRole)设置在配置文件中。 | 10 | 11 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Query-and-Projection-Operators/comment.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$comment 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [定义](#definition) 8 | 9 | * [行为](#behavior) 10 | 11 | * [例子](#example) 12 | 13 | ## 定义 14 | 15 | **$comment** 16 | 17 | `$comment`查询操作符将注释与任何具有查询谓词的表达式关联起来。 18 | 19 | 由于注释会传播到`profile`日志,因此添加注释可以使您的个人资料数据更易于解释和跟踪。 20 | 21 | `$comment`运算符的形式为: 22 | 23 | ```powershell 24 | db.collection.find( { , $comment: } ) 25 | ``` 26 | 27 | ## 行为 28 | 29 | 您可以将_ `$comment`与任何带查询谓词的表达式一起使用,例如聚合管道中`db.collection.update()`或聚合`$match`阶段中的查询谓词 。有关示例,请参见对聚合表达式附加注释。 30 | 31 | ## 例子 32 | 33 | ### 附加评论到`find` 34 | 35 | 以下示例`$comment`在 `find()`操作中添加了: 36 | 37 | ```powershell 38 | db.records.find( 39 | { 40 | x: { $mod: [ 2, 0 ] }, 41 | $comment: "Find even values." 42 | } 43 | ) 44 | ``` 45 | 46 | ### 在聚合表达式上附加注释 47 | 48 | 您可以对`$comment`带查询谓词的任何表达式使用。 49 | 50 | 以下示例在`$match`阶段中使用运算符`$comment`来阐明操作: 51 | 52 | ```powershell 53 | db.records.aggregate( [ 54 | { $match: { x: { $gt: 0 }, $comment: "Don't allow negative inputs." } }, 55 | { $group : { _id: { $mod: [ "$x", 2 ] }, total: { $sum: "$x" } } } 56 | ] ) 57 | ``` 58 | 59 | > **也可以看看** 60 | > 61 | > `$comment` 62 | 63 | 64 | 65 | 译者:李冠飞 66 | 67 | 校对: -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/aggregation-pipeline-operators/ceil-aggregation.md: -------------------------------------------------------------------------------- 1 | # $ceil \(aggregation\) 2 | 3 | 在本页面 4 | 5 | * [定义](ceil-aggregation.md#definition) 6 | * [行为](ceil-aggregation.md#behavior) 7 | * [例子](ceil-aggregation.md#example) 8 | 9 | ## 定义 10 | 11 | **$ceil** 12 | 13 | _3.2版中的新功能。_ 14 | 15 | 返回大于或等于指定数字的最小整数。 16 | 17 | `$ceil`具有以下语法: 18 | 19 | ```text 20 | { $ceil: } 21 | ``` 22 | 23 | ``表达式可以是任何有效的表达,因为它解析为数字。有关表达式的更多信息,请参阅表达式。 24 | 25 | ## 行为 26 | 27 | 如果参数解析为的值或引用缺少的字段,则`$ceil`返回`null`。如果参数解析为`NaN`,则`$ceil`返回`NaN`。 28 | 29 | | 例子 | 结果 | 30 | | :--- | :--- | 31 | | `{ $ceil: 1 }` | `1` | 32 | | `{ $ceil: 7.80 }` | `8` | 33 | | `{ $ceil: -2.8 }` | `-2` | 34 | 35 | ## 例子 36 | 37 | 名为`samples`的集合包含以下文档: 38 | 39 | ```text 40 | { _id: 1, value: 9.25 } 41 | { _id: 2, value: 8.73 } 42 | { _id: 3, value: 4.32 } 43 | { _id: 4, value: -5.34 } 44 | ``` 45 | 46 | 以下事例返回原始值和上限值: 47 | 48 | ```text 49 | db.samples.aggregate([ 50 | { $project: { value: 1, ceilingValue: { $ceil: "$value" } } } 51 | ]) 52 | ``` 53 | 54 | 该操作返回以下结果: 55 | 56 | ```text 57 | { "_id" : 1, "value" : 9.25, "ceilingValue" : 10 } 58 | { "_id" : 2, "value" : 8.73, "ceilingValue" : 9 } 59 | { "_id" : 3, "value" : 4.32, "ceilingValue" : 5 } 60 | { "_id" : 4, "value" : -5.34, "ceilingValue" : -5 } 61 | ``` 62 | 63 | 译者:李冠飞 64 | 65 | 校对: 66 | 67 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/concat-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$concat (aggregation) 2 | []() 3 | 4 | 在本页面 5 | 6 | * [定义](#definition) 7 | 8 | * [例子](#example) 9 | 10 | ## 定义 11 | 12 | **$concat** 13 | 14 | 连接字符串并返回连接的字符串。 15 | 16 | `$concat`具有以下语法: 17 | 18 | ```powershell 19 | { $concat: [ , , ... ] } 20 | ``` 21 | 22 | 参数可以解析为字符串,可以是任何有效的表达式。有关表达式的更多信息,请参见 表达式。 23 | 24 | 如果参数解析为的值`null`或指向缺少的字段,则`$concat`返回`null`。 25 | 26 | ## 例子 27 | 28 | 考虑`inventory`包含以下文档的集合: 29 | 30 | ```powershell 31 | { "_id" : 1, "item" : "ABC1", quarter: "13Q1", "description" : "product 1" } 32 | { "_id" : 2, "item" : "ABC2", quarter: "13Q4", "description" : "product 2" } 33 | { "_id" : 3, "item" : "XYZ1", quarter: "14Q2", "description" : null } 34 | ``` 35 | 36 | 以下操作使用`$concat`运算符将`item`字段和`description`带有“-”定界符的字段连接起来。 37 | 38 | ```powershell 39 | db.inventory.aggregate( 40 | [ 41 | { $project: { itemDescription: { $concat: [ "$item", " - ", "$description" ] } } } 42 | ] 43 | ) 44 | ``` 45 | 46 | 该操作返回以下结果: 47 | 48 | ```powershell 49 | { "_id" : 1, "itemDescription" : "ABC1 - product 1" } 50 | { "_id" : 2, "itemDescription" : "ABC2 - product 2" } 51 | { "_id" : 3, "itemDescription" : null } 52 | ``` 53 | 54 | 55 | 56 | 译者:李冠飞 57 | 58 | 校对: -------------------------------------------------------------------------------- /docs/Aggregation/Map-Reduce/Map-Reduce-and-Sharded-Collections.md: -------------------------------------------------------------------------------- 1 | # [ ](#)Map-Reduce 和分片集合 2 | []() 3 | 4 | 在本页面 5 | 6 | * [分片集合作为输入](#sharded-collection-as-input) 7 | 8 | * [分片集合作为输出](#sharded-collection-as-output) 9 | 10 | Map-reduce 支持对分片集合的操作,既可以作为输入也可以作为输出。本节介绍[MapReduce]()特定于分片集合的操作。 11 | 12 | []() 13 | 14 | []() 15 | 16 | ## 分片集合作为输入 17 | 18 | 当使用分片集合作为 map-reduce 操作的输入时,[mongos]()将自动将 map-reduce job 分派给 parallel 中的每个分片。不需要特殊选项。 [mongos]()将等待所有分片上的作业完成。 19 | 20 | []() 21 | 22 | ## 分片集合作为输出 23 | 24 | 如果[MapReduce]()的`out`字段具有`sharded` 值,则 MongoDB 使用`_id`字段将输出集合分片为分片键。 25 | 26 | 要输出到分片集合: 27 | 28 | * 如果输出集合不存在,请首先创建分片集合 29 | 30 | 从版本4.2开始,MongoDB弃用map-reduce选项以 *创建*新的分片集合,并将该`sharded` 选项用于map-reduce。因此,要输出到分片集合,请首先创建分片集合。 31 | 32 | 如果您没有首先创建分片集合,则MongoDB会在`_id`字段上创建和分片集合。但是,建议您首先创建分片集合。 33 | 34 | * 从4.2版开始,MongoDB不赞成替换现有的分片集合。 35 | 36 | * 从版本4.0开始,如果输出集合已存在但未分片,则map-reduce失败。 37 | 38 | * 对于新的或空的分片集合,MongoDB使用map-reduce操作的第一阶段的结果来创建在分片之间分布的初始块。 39 | 40 | * [`mongos`]()并行地将映射减少后处理作业分派给拥有块的每个分片。在后处理期间,每个分片将从其他分片中提取其自身块的结果,运行最终的reduce / finalize,然后本地写入输出集合。 41 | > **注意** 42 | > 43 | > * 在以后的 map-reduce 作业中,MongoDB 根据需要拆分块。 44 | > 45 | > * 在 post-processing 期间会自动阻止输出集合的块平衡,以避免并发问题。 46 | 47 | 48 | 49 | 译者:李冠飞 50 | 51 | 校对:小芒果 52 | -------------------------------------------------------------------------------- /docs/Aggregation/Aggregation-Pipeline/Aggregation-Pipeline-Limits.md: -------------------------------------------------------------------------------- 1 | # [ ](#)聚合管道限制 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [结果大小限制](#result-size-restrictions) 8 | 9 | * [Memory 限制](#memory-restrictions) 10 | 11 | 使用[聚合]()命令的聚合操作具有以下限制。 12 | 13 | []() 14 | 15 | ## 结果大小限制 16 | 17 | Mongodb 3.6版本的改变:MongoDB 3.6 删除[聚合]()命令以将其结果作为单个文档返回的选项。 18 | 19 | [聚合]()命令可以返回一个游标或将结果存储集合中。返回游标或将结果存储在集合中时,结果集中的每个文档都受[BSON 文件大小]()限制,目前为 16 兆字节;如果任何单个文档超过[BSON 文件大小]()限制,该命令将产生错误。该限制仅适用于返回的文件;在管道处理期间,文档可能超过此大小。 [db.collection.aggregate()]()方法默认返回游标。 20 | 21 | []() 22 | 23 | []() 24 | 25 | ## Memory 限制 26 | 27 | 管道阶段的 RAM 限制为 100M(100\*1024\*1024字节)。如果某个阶段超出此限制,MongoDB 将产生错误。要允许处理大型数据集,可以在`aggregate()`方法中设置`allowDiskUse`选项。`allowDiskUse`选项允许大多数聚合管道操作可以将数据写入临时文件。 以下聚合操作是`allowDiskUse`选项的例外; 这些操作必须在内存限制内: 28 | 29 | * `$graphLookup`阶段 30 | * `$group`阶段中使用的`$addToSet`累加器表达式(从版本4.2.3、4.0.14、3.6.17开始) 31 | * `$group`阶段使用的`$push`累加器表达式(从版本4.2.3、4.0.14、3.6.17开始) 32 | 33 | 如果管道包含在`aggregate()`操作中观察`allowDiskUse: true`的其他阶段,那么`allowDiskUse: true`选项对这些其他阶段有效。 34 | 35 | 从MongoDB 4.2开始,如果任何聚合阶段由于内存限制而将数据写到临时文件,则分析器日志消息和诊断日志消息包括一个usedDisk指示器。 36 | 37 | 38 | > **[success] 可以看看** 39 | > 40 | > [$sort and Memory Restrictions]()和[$group Operator and Memory]()。 41 | 42 | 43 | 44 | 译者:李冠飞 45 | 46 | 校对:李冠飞 -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-copyTo.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.copyTo() 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [定义](#definition) 8 | 9 | * [行为](#behavior) 10 | 11 | * [例子](#examples) 12 | 13 | ## 定义 14 | 15 | * `db.collection.` `copyTo`(newCollection) 16 | 17 | * 自 version 3.0 以来已弃用。 18 | 19 | 使用 server-side JavaScript 将`collection`中的所有文档复制到`newCollection`。如果`newCollection`不存在,MongoDB 会创建它。 20 | 21 | 如果启用了授权,则必须能够访问 order run db.collection.copyTo()中所有资源的所有操作。建议不要提供此类访问权限,但如果您的组织要求用户 run db.collection.copyTo(),请创建一个在anyResource上授予anyAction的角色。不要将此角色分配给任何其他用户。 22 | 23 | | 参数 | 类型 | 描述 | 24 | | --------------- | ------ | --------------------------- | 25 | | `newCollection` | string | 要将数据写入的集合的 name。 | 26 | 27 | > **警告** 28 | > 29 | > 使用 db.collection.copyTo()检查字段类型时,确保操作不会在从 BSON 转换为 JSON 期间从文档中删除类型信息。 30 | > db.collection.copyTo()方法在内部使用EVAL命令。因此,db.collection.copyTo()操作采用 global 锁定,阻止所有其他读取和写入操作,直到db.collection.copyTo()完成。 31 | 32 | copyTo()返回复制的文档数。如果复制失败,则抛出 exception。 33 | 34 | ## 行为 35 | 36 | 因为copyTo()在内部使用EVAL,所以复制操作将阻止mongod实例上的所有其他操作。 37 | 38 | ## 例子 39 | 40 | 以下操作将`source`集合中的所有文档复制到`target`集合中。 41 | 42 | ```powershell 43 | db.source.copyTo(target) 44 | ``` 45 | 46 | 47 | 48 | 译者:李冠飞 49 | 50 | 校对: -------------------------------------------------------------------------------- /docs/Aggregation/Aggregation-Reference/Aggregation-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)聚合命令 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [聚合命令](#id1) 8 | 9 | * [聚合方法](#aggregation-methods) 10 | > **[success] 注意** 11 | > 12 | > 有关特定运算符的详细信息,包括语法和示例,请单击特定的运算符以转到其参考页面。 13 | 14 | []() 15 | 16 | ## 聚合命令 17 | 18 | | 名称 | 描述 | 19 | | ------------- | ---------------------------------------------------- | 20 | | [aggregate]() | 使用聚合框架执行聚合任务,例如 group。 | 21 | | [count]() | 计算集合或视图中的文档数。 | 22 | | [distinct]() | 显示在集合或视图中为指定 key 找到的不同值。 | 23 | | [mapReduce]() | 对大型数据集执行[map-reduce](../Map-Reduce.md)聚合。 | 24 | 25 | []() 26 | 27 | ## 聚合方法 28 | 29 | | 名称 | 描述 | 30 | | ------------------------------------------------------------ | ---------------------------------------------------- | 31 | | [db.collection.aggregate()](../../Reference/mongo-Shell-Methods/Collection-Methods/db-collection-aggregate.md) | 提供对[聚合管道](../Aggregation-Pipeline.md)的访问。 | 32 | | [db.collection.mapReduce()](../../docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-mapReduce.md) | 对大型数据集执行[map-reduce](../Map-Reduce.md)聚合。 | 33 | 34 | 35 | 36 | 译者:李冠飞 37 | 38 | 校对:李冠飞 -------------------------------------------------------------------------------- /can-kao/mongo-shell-methods/collection-methods/db-collection-reindex.md: -------------------------------------------------------------------------------- 1 | # db.collection.reIndex\(\) 2 | 3 | 在本页面 4 | 5 | * [行为](db-collection-reindex.md#behaviors) 6 | 7 | `db.collection.` `reIndex` \(\) 8 | 9 | db.collection.reIndex\(\)删除集合上的所有索引并重新创建它们。对于具有大量数据 and/or 大量索引的集合,此操作可能很费时。 10 | 11 | > **警告** 12 | > 13 | > * 对于大多数用户,不需要db.collection.reIndex\(\)操作。 14 | > * 避免对副本集中的集合 running db.collection.reIndex\(\)。 15 | > * 不要对分片 cluster 中的集合运行db.collection.reIndex\(\)。 16 | > 17 | > _在版本4.2中进行了更改:_ MongoDB不允许`db.collection.reIndex()`在上运行`mongos`,对分片`db.collection.reIndex()`群集中的集合实施了更严格的限制 。 18 | 19 | ## 行为 20 | 21 | > **注意** 22 | > 23 | > 对于副本\_set,db.collection.reIndex\(\)不会从主节点传播到从节点。 db.collection.reIndex\(\)只会影响单个mongod实例。 24 | 25 | > **重要** 26 | > 27 | > 由于多索引构建中描述的逻辑,db.collection.reIndex\(\)始终在前台构建索引。 28 | 29 | * 对于将featureCompatibilityVersion(fCV)设置为`"4.0"` 或更早版本的MongoDB 2.6至MongoDB版本, 如果现有文档的索引条目超过,则MongoDB **不会**在集合上创建索引。`Maximum Index Key Length` 30 | 31 | ### 资源锁定 32 | 33 | _在版本4.2.2中更改。_ 34 | 35 | 对于MongoDB 4.2.2及更高版本,请`db.collection.reIndex()`在集合上获得排他(W)锁,并阻止对该集合进行其他操作,直到完成。 36 | 37 | 对于MongoDB 4.0.0到4.2.1,`db.collection.reIndex()` 获得全局排他(W)锁并在上阻止其他操作, `mongod`直到完成。 38 | 39 | 对于MongoDB 3.6及更早版本,这些操作 `db.collection.reIndex()`在数据库上获得排他(W)锁,并阻塞数据库上的其他操作,直到完成。 40 | 41 | 有关锁定MongoDB的更多信息,请参阅FAQ:并发。 42 | 43 | > **也可以看看** 44 | > 45 | > 索引 46 | 47 | 译者:李冠飞 48 | 49 | 校对: 50 | 51 | -------------------------------------------------------------------------------- /run_website.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | loginfo() { echo "[INFO] $@"; } 3 | logerror() { echo "[ERROR] $@" 1>&2; } 4 | 5 | python3 src/init_gitbook.py versions 6 | python3 src/script.py "home" "book" 7 | rm -rf node_modules/gitbook-plugin-tbfed-pagefooter 8 | gitbook install 9 | python3 src/script.py "home" "powered" 10 | python3 src/script.py "home" "gitalk" 11 | gitbook build ./ _book 12 | # python3 src/script.py "home" "index" 13 | 14 | for version in $versions;do 15 | loginfo "===========================================================" 16 | loginfo "开始", "版本编译" 17 | 18 | echo "cp book.json docs/${version}" 19 | cp book.json docs/${version} 20 | 21 | # 替换 book.json 的编辑地址 22 | echo "python3 src/script.py ${version} book" 23 | python3 src/script.py ${version} "book" 24 | 25 | echo "cp -r node_modules docs/${version}" 26 | rm -rf docs/${version}/node_modules 27 | cp -r node_modules docs/${version} 28 | 29 | echo "gitbook install docs/${version}" 30 | gitbook install docs/${version} 31 | 32 | echo "python3 src/script.py ${version} powered" 33 | python3 src/script.py ${version} "powered" 34 | 35 | echo "python3 src/script.py ${version} gitalk" 36 | python3 src/script.py ${version} "gitalk" 37 | 38 | echo "gitbook build docs/${version} _book/docs/${version}" 39 | gitbook build docs/${version} _book/docs/${version} 40 | 41 | 42 | done 43 | 44 | -------------------------------------------------------------------------------- /aggregation/map-reduce/map-reduce-and-sharded-collections.md: -------------------------------------------------------------------------------- 1 | # Map-Reduce 和分片集合 2 | 3 | 在本页面 4 | 5 | * [分片集合作为输入](map-reduce-and-sharded-collections.md#sharded-collection-as-input) 6 | * [分片集合作为输出](map-reduce-and-sharded-collections.md#sharded-collection-as-output) 7 | 8 | Map-reduce 支持对分片集合的操作,既可以作为输入也可以作为输出。本节介绍[MapReduce](map-reduce-and-sharded-collections.md)特定于分片集合的操作。 9 | 10 | ## 分片集合作为输入 11 | 12 | 当使用分片集合作为 map-reduce 操作的输入时,[mongos](map-reduce-and-sharded-collections.md)将自动将 map-reduce job 分派给 parallel 中的每个分片。不需要特殊选项。 [mongos](map-reduce-and-sharded-collections.md)将等待所有分片上的作业完成。 13 | 14 | ## 分片集合作为输出 15 | 16 | 如果[MapReduce](map-reduce-and-sharded-collections.md)的`out`字段具有`sharded` 值,则 MongoDB 使用`_id`字段将输出集合分片为分片键。 17 | 18 | 要输出到分片集合: 19 | 20 | * 如果输出集合不存在,请首先创建分片集合 21 | 22 | 从版本4.2开始,MongoDB弃用map-reduce选项以 _创建_新的分片集合,并将该`sharded` 选项用于map-reduce。因此,要输出到分片集合,请首先创建分片集合。 23 | 24 | 如果您没有首先创建分片集合,则MongoDB会在`_id`字段上创建和分片集合。但是,建议您首先创建分片集合。 25 | 26 | * 从4.2版开始,MongoDB不赞成替换现有的分片集合。 27 | * 从版本4.0开始,如果输出集合已存在但未分片,则map-reduce失败。 28 | * 对于新的或空的分片集合,MongoDB使用map-reduce操作的第一阶段的结果来创建在分片之间分布的初始块。 29 | * [`mongos`](map-reduce-and-sharded-collections.md)并行地将映射减少后处理作业分派给拥有块的每个分片。在后处理期间,每个分片将从其他分片中提取其自身块的结果,运行最终的reduce / finalize,然后本地写入输出集合。 30 | 31 | > **注意** 32 | > 33 | > * 在以后的 map-reduce 作业中,MongoDB 根据需要拆分块。 34 | > * 在 post-processing 期间会自动阻止输出集合的块平衡,以避免并发问题。 35 | 36 | 译者:李冠飞 37 | 38 | 校对:小芒果 39 | 40 | -------------------------------------------------------------------------------- /docs/Reference/Database-Commands/Replication-Commands.md: -------------------------------------------------------------------------------- 1 | # [ ](#)复制命令 2 | 3 | []() 4 | 5 | > **注意** 6 | > 7 | > 有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。 8 | 9 | | 名称 | 描述 | 10 | | -------------------------------- | ------------------------------------------------------------ | 11 | | [`applyOps`]() | 应用于内部命令OPLOG条目到当前数据集。 | 12 | | [`isMaster`]() | 显示有关此成员在副本集中的角色的信息,包括它是否为主角色。 | 13 | | [`replSetAbortPrimaryCatchUp`]() | 强制选择的主数据库中止同步(追赶),然后完成到主数据库的过渡。 | 14 | | [`replSetFreeze`]() | 防止当前成员在一段时间内寻求选举为主。 | 15 | | [`replSetGetConfig`]() | 返回副本集的配置对象。 | 16 | | [`replSetGetStatus`]() | 返回报告副本集状态的文档。 | 17 | | [`replSetInitiate`]() | 初始化新的副本集。 | 18 | | [`replSetMaintenance`]() | 启用或禁用维护模式,该模式将辅助节点置于一种`RECOVERING`状态。 | 19 | | [`replSetReconfig`]() | 将新配置应用于现有副本集。 | 20 | | [`replSetResizeOplog`]() | 动态调整副本集成员的操作日志的大小。仅适用于WiredTiger存储引擎。 | 21 | | [`replSetStepDown`]() | 当前`primary`下台,成为一个`secondary`,迫使选举。 | 22 | | [`replSetSyncFrom`]() | 显式覆盖用于选择要复制的成员的默认逻辑。 | 23 | 24 | 25 | 26 | 译者:李冠飞 27 | 28 | 校对: 29 | -------------------------------------------------------------------------------- /docs/Reference/mongo-Shell-Methods/Collection-Methods/db-collection-reIndex.md: -------------------------------------------------------------------------------- 1 | # [ ](#)db.collection.reIndex() 2 | 3 | []() 4 | 5 | 在本页面 6 | 7 | * [行为](#behaviors) 8 | 9 | 10 | `db.collection.` `reIndex` () 11 | 12 | db.collection.reIndex()删除集合上的所有索引并重新创建它们。对于具有大量数据 and/or 大量索引的集合,此操作可能很费时。 13 | 14 | > **警告** 15 | > 16 | >* 对于大多数用户,不需要db.collection.reIndex()操作。 17 | >* 避免对副本集中的集合 running db.collection.reIndex()。 18 | >* 不要对分片 cluster 中的集合运行db.collection.reIndex()。 19 | > 20 | >*在版本4.2中进行了更改:* MongoDB不允许`db.collection.reIndex()`在上运行`mongos`,对分片`db.collection.reIndex()`群集中的集合实施了更严格的限制 。 21 | 22 | ## 行为 23 | 24 | > **注意** 25 | > 26 | > 对于副本_set,db.collection.reIndex()不会从主节点传播到从节点。 db.collection.reIndex()只会影响单个mongod实例。 27 | 28 |
29 | 30 | > **重要** 31 | > 32 | > 由于多索引构建中描述的逻辑,db.collection.reIndex()始终在前台构建索引。 33 | 34 | * 对于将featureCompatibilityVersion(fCV)设置为`"4.0"` 或更早版本的MongoDB 2.6至MongoDB版本, 如果现有文档的索引条目超过,则MongoDB **不会**在集合上创建索引。`Maximum Index Key Length` 35 | 36 | ### 资源锁定 37 | 38 | *在版本4.2.2中更改。* 39 | 40 | 对于MongoDB 4.2.2及更高版本,请`db.collection.reIndex()`在集合上获得排他(W)锁,并阻止对该集合进行其他操作,直到完成。 41 | 42 | 对于MongoDB 4.0.0到4.2.1,`db.collection.reIndex()` 获得全局排他(W)锁并在上阻止其他操作, `mongod`直到完成。 43 | 44 | 对于MongoDB 3.6及更早版本,这些操作 `db.collection.reIndex()`在数据库上获得排他(W)锁,并阻塞数据库上的其他操作,直到完成。 45 | 46 | 有关锁定MongoDB的更多信息,请参阅FAQ:并发。 47 | 48 | > **也可以看看** 49 | > 50 | > 索引 51 | 52 | 53 | 54 | 译者:李冠飞 55 | 56 | 校对: -------------------------------------------------------------------------------- /indexes/geohaystack-indexes/README.md: -------------------------------------------------------------------------------- 1 | # geoHaystack 索引 2 | 3 | **在本页面** 4 | 5 | * [行为](./#行为) 6 | * [`sparse` 属性](./#属性) 7 | * [创建`geoHaystack`索引](./#索引) 8 | 9 | **“geoHaystack”**索引是一种特殊的索引,优化后可以在小范围内返回结果。**“geoHaystack”**索引提高了使用平面几何图形查询的性能。 10 | 11 | 对于使用球形几何的查询,**2dsphere索引**比haystack索引**更好**。[2dsphere索引](https://docs.mongodb.com/master/core/2dsphere/)允许字段重新排序;`geoHaystack`索引要求第一个字段为位置字段。另外,`geoHaystack` 索引只能通过命令使用,因此总是一次返回所有结果。 12 | 13 | ## 行为 14 | 15 | `geoHaystack`索引从同一地理区域创建文档的“存储桶”,以提高限于该区域的查询的性能。`geoHaystack`索引中的每个存储段都包含在给定经度和纬度指定邻近范围内的所有文档。 16 | 17 | ## sparse属性 18 | 19 | `geoHaystack`索引默认为[sparse](https://docs.mongodb.com/master/core/index-sparse/),忽略[sparse: true](https://docs.mongodb.com/master/core/index-sparse/)选项。如果一个文档缺少一个`geoHaystack`索引字段\(或者该字段是“null”或空数组\),MongoDB不会为该文档添加一个条目到`geoHaystack`索引中。对于插入,MongoDB插入文档,但不添加到`geoHaystack`索引。 20 | 21 | `geoHaystack`索引包括一个`geoHaystack`索引键和一个非地理空间索引键;但是,只有`geoHaystack`索引字段决定索引是否引用文档。 22 | 23 | ### 排序选项 24 | 25 | `geoHaystack`索引只支持简单的二进制比较,不支持[collation](https://docs.mongodb.com/master/reference/bson-type-comparison-order/#collation)。 26 | 27 | 要在具有非简单排序规则的集合上创建`geoHaystack`索引,必须在创建索引时显式指定`{collation: {locale: "simple"}}`。 28 | 29 | ## 创建`geoHaystack`索引 30 | 31 | 要创建`geoHaystack`索引,请参见[创建Haystack索引](https://docs.mongodb.com/master/tutorial/build-a-geohaystack-index/)。有关查询haystack索引的信息和示例,请参见[查询haystack索引](https://docs.mongodb.com/master/tutorial/query-a-geohaystack-index/)。 32 | 33 | -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/abs-aggregation.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # [ ](#)$abs (aggregation) 4 | 5 | []() 6 | 7 | 在本页面 8 | 9 | * [定义](#definition) 10 | 11 | * [行为](#behavior) 12 | 13 | * [例子](#example) 14 | 15 | ## 定义 16 | 17 | **$abs** 18 | 19 | version 3.2 中的新内容。 20 | 21 | 返回数字的绝对 value。 22 | 23 | `$abs`具有以下语法: 24 | 25 | ```powershell 26 | { $abs: } 27 | ``` 28 | 29 | ``表达式可以是任何有效的表达,因为它解析为数字。有关表达式的更多信息,请参阅表达式。 30 | 31 | ## 行为 32 | 33 | 如果参数解析为的值或引用缺少的字段,则`$abs`返回`null`。如果参数解析为`NaN`,则`$abs`返回`NaN`。 34 | 35 | | 例子 | 结果 | 36 | | ---------------- | ------ | 37 | | `{ $abs: -1 }` | `1` | 38 | | `{ $abs: 1 }` | `1` | 39 | | `{ $abs: null }` | `null` | 40 | 41 | ## 例子 42 | 43 | 集合`ratings`包含以下文档: 44 | 45 | ```powershell 46 | { _id: 1, start: 5, end: 8 } 47 | { _id: 2, start: 4, end: 4 } 48 | { _id: 3, start: 9, end: 7 } 49 | { _id: 4, start: 6, end: 7 } 50 | ``` 51 | 52 | 53 | 以下 example 计算`start`和`end`评级之间的差异大小: 54 | 55 | ```powershell 56 | db.ratings.aggregate([ 57 | { 58 | $project: { delta: { $abs: { $subtract: [ "$start", "$end" ] } } } 59 | } 60 | ]) 61 | ``` 62 | 63 | 该操作返回以下结果: 64 | 65 | ```powershell 66 | { "_id" : 1, "delta" : 3 } 67 | { "_id" : 2, "delta" : 0 } 68 | { "_id" : 3, "delta" : 2 } 69 | { "_id" : 4, "delta" : 1 } 70 | ``` 71 | 72 | 73 | 74 | 译者:李冠飞 75 | 76 | 校对: -------------------------------------------------------------------------------- /docs/Reference/Operators/Aggregation-Pipeline-Operators/ceil-aggregation.md: -------------------------------------------------------------------------------- 1 | # [ ](#)$ceil (aggregation) 2 | []() 3 | 在本页面 4 | 5 | * [定义](#definition) 6 | 7 | * [行为](#behavior) 8 | 9 | * [例子](#example) 10 | 11 | ## 定义 12 | 13 | **$ceil** 14 | 15 | *3.2版中的新功能。* 16 | 17 | 返回大于或等于指定数字的最小整数。 18 | 19 | `$ceil`具有以下语法: 20 | 21 | ```powershell 22 | { $ceil: } 23 | ``` 24 | 25 | ``表达式可以是任何有效的表达,因为它解析为数字。有关表达式的更多信息,请参阅表达式。 26 | 27 | ## 行为 28 | 29 | 如果参数解析为的值或引用缺少的字段,则`$ceil`返回`null`。如果参数解析为`NaN`,则`$ceil`返回`NaN`。 30 | 31 | | 例子 | 结果 | 32 | | ----------------- | ---- | 33 | | `{ $ceil: 1 }` | `1` | 34 | | `{ $ceil: 7.80 }` | `8` | 35 | | `{ $ceil: -2.8 }` | `-2` | 36 | 37 | ## 例子 38 | 39 | 名为`samples`的集合包含以下文档: 40 | 41 | ```powershell 42 | { _id: 1, value: 9.25 } 43 | { _id: 2, value: 8.73 } 44 | { _id: 3, value: 4.32 } 45 | { _id: 4, value: -5.34 } 46 | ``` 47 | 48 | 以下事例返回原始值和上限值: 49 | 50 | ```powershell 51 | db.samples.aggregate([ 52 | { $project: { value: 1, ceilingValue: { $ceil: "$value" } } } 53 | ]) 54 | ``` 55 | 56 | 该操作返回以下结果: 57 | 58 | ```powershell 59 | { "_id" : 1, "value" : 9.25, "ceilingValue" : 10 } 60 | { "_id" : 2, "value" : 8.73, "ceilingValue" : 9 } 61 | { "_id" : 3, "value" : 4.32, "ceilingValue" : 5 } 62 | { "_id" : 4, "value" : -5.34, "ceilingValue" : -5 } 63 | ``` 64 | 65 | 66 | 67 | 译者:李冠飞 68 | 69 | 校对: -------------------------------------------------------------------------------- /src/script.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | import os 3 | import sys 4 | 5 | 6 | def format_file(filename, str1, str2): 7 | """ 8 | 文件内容的替换功能 9 | :return: 10 | """ 11 | with open(filename, 'r') as f: 12 | var_object = f.read() 13 | if "gitalk" not in var_object: 14 | var_object = var_object.replace(str1, str2) 15 | # print(var_object) 16 | 17 | f = open(filename, "w") 18 | f.write(var_object) 19 | 20 | 21 | if __name__ == "__main__": 22 | version, u_type = sys.argv[1], sys.argv[2] 23 | 24 | tag = True 25 | if u_type == "index": 26 | tag = False 27 | 28 | elif u_type == "book": 29 | if version == "home": 30 | filename = "book.json" 31 | tag = False 32 | else: 33 | filename = "docs/%s/book.json" % version 34 | str1 = "https://github.com/apachecn/sklearn-doc-zh/blob/master" 35 | str2 = "https://github.com/apachecn/sklearn-doc-zh/blob/master/docs/%s" % version 36 | 37 | elif u_type == "powered": 38 | if version == "home": 39 | filename = "node_modules/gitbook-plugin-tbfed-pagefooter/index.js" 40 | else: 41 | filename = "docs/%s/node_modules/gitbook-plugin-tbfed-pagefooter/index.js" % version 42 | str1 = "powered by Gitbook" 43 | str2 = "由 MongoDB中文社区 提供技术支持" 44 | 45 | 46 | # 状态为 True 就进行替换 47 | if tag: format_file(filename, str1, str2) 48 | -------------------------------------------------------------------------------- /aggregation/aggregation-pipeline/aggregation-pipeline-limits.md: -------------------------------------------------------------------------------- 1 | # 聚合管道限制 2 | 3 | 在本页面 4 | 5 | * [结果大小限制](aggregation-pipeline-limits.md#result-size-restrictions) 6 | * [Memory 限制](aggregation-pipeline-limits.md#memory-restrictions) 7 | 8 | 使用[聚合](aggregation-pipeline-limits.md)命令的聚合操作具有以下限制。 9 | 10 | ## 结果大小限制 11 | 12 | Mongodb 3.6版本的改变:MongoDB 3.6 删除[聚合](aggregation-pipeline-limits.md)命令以将其结果作为单个文档返回的选项。 13 | 14 | [聚合](aggregation-pipeline-limits.md)命令可以返回一个游标或将结果存储集合中。返回游标或将结果存储在集合中时,结果集中的每个文档都受[BSON 文件大小](aggregation-pipeline-limits.md)限制,目前为 16 兆字节;如果任何单个文档超过[BSON 文件大小](aggregation-pipeline-limits.md)限制,该命令将产生错误。该限制仅适用于返回的文件;在管道处理期间,文档可能超过此大小。 [db.collection.aggregate\(\)](aggregation-pipeline-limits.md)方法默认返回游标。 15 | 16 | ## Memory 限制 17 | 18 | 管道阶段的 RAM 限制为 100M(100\*1024\*1024字节)。如果某个阶段超出此限制,MongoDB 将产生错误。要允许处理大型数据集,可以在`aggregate()`方法中设置`allowDiskUse`选项。`allowDiskUse`选项允许大多数聚合管道操作可以将数据写入临时文件。 以下聚合操作是`allowDiskUse`选项的例外; 这些操作必须在内存限制内: 19 | 20 | * `$graphLookup`阶段 21 | * `$group`阶段中使用的`$addToSet`累加器表达式(从版本4.2.3、4.0.14、3.6.17开始) 22 | * `$group`阶段使用的`$push`累加器表达式\(从版本4.2.3、4.0.14、3.6.17开始\) 23 | 24 | 如果管道包含在`aggregate()`操作中观察`allowDiskUse: true`的其他阶段,那么`allowDiskUse: true`选项对这些其他阶段有效。 25 | 26 | 从MongoDB 4.2开始,如果任何聚合阶段由于内存限制而将数据写到临时文件,则分析器日志消息和诊断日志消息包括一个usedDisk指示器。 27 | 28 | > **\[success\] 可以看看** 29 | > 30 | > [$sort and Memory Restrictions](aggregation-pipeline-limits.md)和[$group Operator and Memory](aggregation-pipeline-limits.md)。 31 | 32 | 译者:李冠飞 33 | 34 | 校对:李冠飞 35 | 36 | -------------------------------------------------------------------------------- /docs/Indexes/geoHaystack-Indexes.md: -------------------------------------------------------------------------------- 1 | ## geoHaystack索引 2 | 3 | **在本页面** 4 | 5 | - [行为](#行为) 6 | - [`sparse` 属性](#属性) 7 | - [创建`geoHaystack`索引](#索引) 8 | 9 | **“geoHaystack”**索引是一种特殊的索引,优化后可以在小范围内返回结果。**“geoHaystack”**索引提高了使用平面几何图形查询的性能。 10 | 11 | 对于使用球形几何的查询,**2dsphere索引**比haystack索引**更好**。[2dsphere索引](https://docs.mongodb.com/master/core/2dsphere/)允许字段重新排序;`geoHaystack`索引要求第一个字段为位置字段。另外,`geoHaystack` 索引只能通过命令使用,因此总是一次返回所有结果。 12 | 13 | ### 行为 14 | 15 | `geoHaystack`索引从同一地理区域创建文档的“存储桶”,以提高限于该区域的查询的性能。`geoHaystack`索引中的每个存储段都包含在给定经度和纬度指定邻近范围内的所有文档。 16 | 17 | ### sparse属性 18 | 19 | `geoHaystack`索引默认为[sparse](https://docs.mongodb.com/master/core/index-sparse/),忽略[sparse: true](https://docs.mongodb.com/master/core/index-sparse/)选项。如果一个文档缺少一个`geoHaystack`索引字段(或者该字段是“null”或空数组),MongoDB不会为该文档添加一个条目到`geoHaystack`索引中。对于插入,MongoDB插入文档,但不添加到`geoHaystack`索引。 20 | 21 | `geoHaystack`索引包括一个`geoHaystack`索引键和一个非地理空间索引键;但是,只有`geoHaystack`索引字段决定索引是否引用文档。 22 | 23 | #### 排序选项 24 | 25 | `geoHaystack`索引只支持简单的二进制比较,不支持[collation](https://docs.mongodb.com/master/reference/bson-type-comparison-order/#collation)。 26 | 27 | 要在具有非简单排序规则的集合上创建`geoHaystack`索引,必须在创建索引时显式指定`{collation: {locale: "simple"}}`。 28 | 29 | ### 创建`geoHaystack`索引 30 | 31 | 要创建`geoHaystack`索引,请参见[创建Haystack索引](https://docs.mongodb.com/master/tutorial/build-a-geohaystack-index/)。有关查询haystack索引的信息和示例,请参见[查询haystack索引](https://docs.mongodb.com/master/tutorial/query-a-geohaystack-index/)。 32 | 33 | -------------------------------------------------------------------------------- /Reference/README.md: -------------------------------------------------------------------------------- 1 | # 参考 2 | 3 | ## MongoDB中文社区 4 | 5 | ![MongoDB中文社区—MongoDB爱好者技术交流平台](https://mongoing.com/wp-content/uploads/2020/09/6de8a4680ef684d-2.png) 6 | 7 | | 资源列表推荐 | 资源入口 | 8 | | :--- | :--- | 9 | | MongoDB中文社区官网 | [https://mongoing.com/](https://mongoing.com/) | 10 | | 微信服务号 ——最新资讯和优质文章 | Mongoing中文社区(mongoing-mongoing) | 11 | | 微信订阅号 ——发布文档翻译内容 | MongoDB中文用户组(mongoing123) | 12 | | 官方微信号 —— 官方最新资讯 | MongoDB数据库(MongoDB-China) | 13 | | MongoDB中文社区组委会成员介绍 | [https://mongoing.com/core-team-members](https://mongoing.com/core-team-members) | 14 | | MongoDB中文社区翻译小组介绍 | [https://mongoing.com/translators](https://mongoing.com/translators) | 15 | | MongoDB中文社区微信技术交流群 | 添加社区助理小芒果微信(ID:mongoingcom),并备注 mongo | 16 | | MongoDB中文社区会议及文档资源 | [https://mongoing.com/resources](https://mongoing.com/resources) | 17 | | MongoDB中文社区大咖博客 | [基础知识](https://mongoing.com/basic-knowledge) [性能优化](https://mongoing.com/performance-optimization) [原理解读](https://mongoing.com/interpretation-of-principles) [运维监控](https://mongoing.com/operation-and-maintenance-monitoring) [最佳实践](https://mongoing.com/best-practices) | 18 | | MongoDB白皮书 | [https://mongoing.com/mongodb-download-white-paper](https://mongoing.com/mongodb-download-white-paper) | 19 | | MongoDB初学者教程-7天入门 | [https://mongoing.com/mongodb-beginner-tutorial](https://mongoing.com/mongodb-beginner-tutorial) | 20 | | 社区活动邮件订阅 | [https://sourl.cn/spszjN](https://sourl.cn/spszjN) | 21 | 22 | -------------------------------------------------------------------------------- /indexes/geohaystack-indexes/query-a-haystack-index.md: -------------------------------------------------------------------------------- 1 | # 查询Haystack索引 2 | 3 | > 弃用 4 | > 5 | > MongoDB 4.4不支持[geoHaystack](https://docs.mongodb.com/master/core/geohaystack/)索引和[ geoSearch ](https://docs.mongodb.com/master/reference/command/geoSearch/#dbcmd.geoSearch)命令。使用[2d索引](https://docs.mongodb.com/master/reference/operator/aggregation/geoNear/#pipe._S_geoNear)或[ $geoWithin ](https://docs.mongodb.com/master/reference/operator/query/geoWithin/#op._S_geoWithin)代替。 6 | 7 | **Haystack**索引是一种特殊的**2d**地理空间索引,优化后可以在小区域内返回结果。要创建一个haystack索引,请参见[创建一个haystack索引](https://docs.mongodb.com/master/tutorial/build-a-geohaystack-index/#geospatial-indexes-haystack-index)。 8 | 9 | 要查询一个**haystack**索引,使用[ geoSearch ](https://docs.mongodb.com/master/reference/command/geosearch/#dbcmd.geosearch)命令。您必须为[geoSearch](https://docs.mongodb.com/master/reference/command/geosearch/#dbcmd.geosearch)指定坐标和附加字段。例如,要返回示例点附近的**type**字段中值为**restaurant**的所有文档,命令如下: 10 | 11 | ```text 12 | db.runCommand( { geoSearch : "places" , 13 | search : { type: "restaurant" } , 14 | near : [-74, 40.74] , 15 | maxDistance : 10 } ) 16 | ``` 17 | 18 | > 注意 19 | > 20 | > **Haystack**索引不适合查询最接近特定位置的完整文档列表。与存储桶大小相比,最近的文档可能更远。 21 | > 22 | > 请注意 23 | > 24 | > haystack索引目前不支持[球形查询操作](https://docs.mongodb.com/master/tutorial/calculate-distances-using-sphery-geometry%20-with-2d-geospatial-indexes/)。 25 | > 26 | > [find\(\)](https://docs.mongodb.com/master/reference/method/db.collection.find/#db.collection.find)方法不能访问**haystack**索引。 27 | 28 | -------------------------------------------------------------------------------- /shu-ju-mo-xing/README.md: -------------------------------------------------------------------------------- 1 | # MongoDB数据模型 2 | 3 | ## MongoDB中文社区 4 | 5 | ![MongoDB中文社区—MongoDB爱好者技术交流平台](https://mongoing.com/wp-content/uploads/2020/09/6de8a4680ef684d-2.png) 6 | 7 | | 资源列表推荐 | 资源入口 | 8 | | :--- | :--- | 9 | | MongoDB中文社区官网 | [https://mongoing.com/](https://mongoing.com/) | 10 | | 微信服务号 ——最新资讯和优质文章 | Mongoing中文社区(mongoing-mongoing) | 11 | | 微信订阅号 ——发布文档翻译内容 | MongoDB中文用户组(mongoing123) | 12 | | 官方微信号 —— 官方最新资讯 | MongoDB数据库(MongoDB-China) | 13 | | MongoDB中文社区组委会成员介绍 | [https://mongoing.com/core-team-members](https://mongoing.com/core-team-members) | 14 | | MongoDB中文社区翻译小组介绍 | [https://mongoing.com/translators](https://mongoing.com/translators) | 15 | | MongoDB中文社区微信技术交流群 | 添加社区助理小芒果微信(ID:mongoingcom),并备注 mongo | 16 | | MongoDB中文社区会议及文档资源 | [https://mongoing.com/resources](https://mongoing.com/resources) | 17 | | MongoDB中文社区大咖博客 | [基础知识](https://mongoing.com/basic-knowledge) [性能优化](https://mongoing.com/performance-optimization) [原理解读](https://mongoing.com/interpretation-of-principles) [运维监控](https://mongoing.com/operation-and-maintenance-monitoring) [最佳实践](https://mongoing.com/best-practices) | 18 | | MongoDB白皮书 | [https://mongoing.com/mongodb-download-white-paper](https://mongoing.com/mongodb-download-white-paper) | 19 | | MongoDB初学者教程-7天入门 | [https://mongoing.com/mongodb-beginner-tutorial](https://mongoing.com/mongodb-beginner-tutorial) | 20 | | 社区活动邮件订阅 | [https://sourl.cn/spszjN](https://sourl.cn/spszjN) | 21 | 22 | -------------------------------------------------------------------------------- /docs/Indexes/geoHaystack-Indexes/Query-a-Haystack-Index.md: -------------------------------------------------------------------------------- 1 | ## 查询Haystack索引 2 | 3 | > 弃用 4 | > 5 | > MongoDB 4.4不支持[geoHaystack](https://docs.mongodb.com/master/core/geohaystack/)索引和[ geoSearch ](https://docs.mongodb.com/master/reference/command/geoSearch/#dbcmd.geoSearch)命令。使用[2d索引](https://docs.mongodb.com/master/reference/operator/aggregation/geoNear/#pipe._S_geoNear)或[ $geoWithin ](https://docs.mongodb.com/master/reference/operator/query/geoWithin/#op._S_geoWithin)代替。 6 | 7 | **Haystack**索引是一种特殊的**2d**地理空间索引,优化后可以在小区域内返回结果。要创建一个haystack索引,请参见[创建一个haystack索引](https://docs.mongodb.com/master/tutorial/build-a-geohaystack-index/#geospatial-indexes-haystack-index)。 8 | 9 | 要查询一个**haystack**索引,使用[ geoSearch ](https://docs.mongodb.com/master/reference/command/geosearch/#dbcmd.geosearch)命令。您必须为[geoSearch](https://docs.mongodb.com/master/reference/command/geosearch/#dbcmd.geosearch)指定坐标和附加字段。例如,要返回示例点附近的**type**字段中值为**restaurant**的所有文档,命令如下: 10 | 11 | ```shell 12 | db.runCommand( { geoSearch : "places" , 13 | search : { type: "restaurant" } , 14 | near : [-74, 40.74] , 15 | maxDistance : 10 } ) 16 | ``` 17 | 18 | > 注意 19 | > 20 | > **Haystack**索引不适合查询最接近特定位置的完整文档列表。与存储桶大小相比,最近的文档可能更远。 21 | 22 | > 请注意 23 | > 24 | > haystack索引目前不支持[球形查询操作](https://docs.mongodb.com/master/tutorial/calculate-distances-using-sphery-geometry -with-2d-geospatial-indexes/)。 25 | > 26 | > [find()](https://docs.mongodb.com/master/reference/method/db.collection.find/#db.collection.find)方法不能访问**haystack**索引。 27 | 28 | -------------------------------------------------------------------------------- /can-kao/yun-suan-fu/query-modifiers.md: -------------------------------------------------------------------------------- 1 | # 查询修饰符 2 | 3 | 除了MongoDB查询运算符外,还有许多`meta`运算符可让您修改查询的输出或行为。 4 | 5 | > **注意** 6 | > 7 | > `mongo`从v3.2开始在Shell中不推荐使用 8 | > 9 | > 从v3.2开始,`mongo`shell 中不建议使用查询`meta`运算符。在`mongo`shell程序中,改用游标方法 。 10 | 11 | 驱动程序接口可以提供包装这些选项的游标方法。如果可能,请使用这些方法。否则,您可以使用以下两种语法之一添加这些选项: 12 | 13 | ```text 14 | db.collection.find( { } )._addSpecial(