添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
正直的番茄  ·  了解关系数据库的视图·  2 周前    · 
豪爽的灯泡  ·  rows().every()·  1 周前    · 
光明磊落的高山  ·  Bloom 1.4.2(108) ...·  3 周前    · 
完美的红金鱼  ·  ANA-specific ...·  1 月前    · 
冲动的凉茶  ·  紧邻钱江新城二期 ...·  10 月前    · 
  • 在 Linux 上使用 Kerberos 身份验证配置 MongoDB
  • 在 Windows 上使用 Kerberos 身份验证配置 MongoDB
  • Kerberos 身份验证疑难解答
  • 使用 Kerberos 身份验证和 Active Directory 授权配置 MongoDB
  • LDAP 代理验证
  • 通过 ActiveDirectory 使用 SASL 和 LDAP 进行身份验证
  • 使用 SASL 和 LDAP 与 OpenLDAP 进行身份验证
  • 通过本机 LDAP 使用 Active Directory 对用户进行身份验证和授权
  • LDAP Authorization
  • Internal Authentication
  • 使用密钥文件访问控制部署新副本集
  • 在副本集中实施密钥文件访问控制
  • 在不停机的情况下在副本集中实施密钥文件访问控制
  • 使用密钥文件访问控制部署分片群集
  • 在分片群集中实施密钥文件访问控制
  • 在不停机的情况下在现有分片群集中实施身份验证
  • 使用 x.509 证书进行会员身份验证
  • 从密钥文件身份验证升级到 x.509 身份验证
  • Enable Auth
  • Management 用户和角色
  • 更改密码和自定义数据
  • 基于角色的访问控制
  • Built-In Roles
  • User-Defined Roles
  • 集合级访问控制
  • TLS/SSL(传输加密)
  • 为 TLS/SSL 配置 mongod 和 mongos
  • Client 端的 TLS/SSL 配置
  • 升级群集以使用 TLS/SSL
  • 为 FIPS 配置 MongoDB
  • Configure Encryption
  • 旋转加密密钥
  • Auditing
  • Configure Auditing
  • 配置审核过滤器
  • Security Hardening
  • MongoDB 配置强化
  • 加强网络基础设施
  • 为 MongoDB 配置 Linux iptables 防火墙
  • 为 MongoDB 配置 Windows netsh 防火墙
  • 实施字段级别修订
  • Security Reference
  • Built-In Roles
  • system.roles Collection
  • system.users Collection
  • Resource Document
  • Privilege Actions
  • 系统事件审核消息
  • 创建漏洞报告
  • Change Streams
  • 更改流生产建议
  • Change Events
  • Replication
  • 副本集成员
  • 副本集主要
  • 副本集次要成员
  • 优先级 0 副本集成员
  • 隐藏副本集成员
  • 延迟副本集成员
  • 复制集仲裁器
  • 副本集 Oplog
  • 副本集数据同步
  • 副本集部署体系结构
  • 三个成员副本集
  • 跨两个或多个数据中心分布的副本集
  • 副本集高可用性
  • 副本集选举
  • 副本集故障转移期间的回滚
  • 复制集读取和写入语义
  • 写副本集关注点
  • Read Preference
  • 服务器选择算法
  • 副本集部署教程
  • 部署副本集
  • 部署副本集以进行测试和开发
  • 部署地理冗余副本集
  • 将仲裁器添加到副本集
  • 将独立版本转换为副本集
  • 将成员添加到副本集中
  • 从副本集中删除成员
  • 替换副本集成员
  • 成员配置教程
  • 调整副本集成员的优先级
  • 防止中学成为小学
  • 配置隐藏副本集成员
  • 配置延迟副本集成员
  • 配置非投票副本集成员
  • 将辅助节点转换为仲裁者
  • 副本集维护教程
  • 更改操作日志的大小
  • 对副本集成员执行维护
  • 强制会员成为主要会员
  • 重新同步副本集的成员
  • 配置副本集标记集
  • 用不可用的成员重新配置副本集
  • Management 链式复制
  • 更改副本集中的主机名
  • 配置辅助节点的同步目标
  • Replication Reference
  • 副本集配置
  • 副本集协议版本
  • 对副本集进行故障排除
  • 本地数据库
  • 副本集成员国
  • 阅读偏好参考
  • Sharding
  • 分片集群组件
  • Shards
  • 配置服务器(元数据)
  • Router (mongos)
  • Shard Keys
  • Hashed Sharding
  • Ranged Sharding
  • 部署分片集群
  • Zones
  • Management 碎片区
  • 按位置细分数据
  • 用于更改 SLA 或 SLO 的分层硬件
  • 按应用或 Client 细分数据
  • 仅插入工作负载的分布式本地写入
  • 使用块进行数据分区
  • 在分片群集中创建块
  • 分片群集中的分割块
  • 在分片群集中合并块
  • 修改分片群集中的块大小
  • Balancer
  • Management 分片集群平衡器
  • 在分片群集中迁移块
  • Administration
  • 配置服务器 Management
  • 更换配置服务器
  • 查看集群配置
  • 重新启动分片群集
  • 将分片群集迁移到其他硬件
  • 将分片添加到集群
  • 从现有分片群集中删除分片
  • 清除巨型标志
  • 备份群集元数据
  • 将分片群集转换为副本集
  • 将副本集转换为分片群集
  • 将分片独立版转换为分片副本集
  • Sharding Reference
  • Operational Restrictions
  • 对分片群集进行故障排除
  • Config Database
  • Administration
  • Production Notes
  • Operations Checklist
  • Development Checklist
  • Performance
  • Database Profiler
  • 数据库探查器输出
  • 禁用透明大页面(THP)
  • UNIX ulimit 设置
  • 配置与维护
  • 运行时数据库配置
  • 升级到最新版本的 MongoDB
  • Managementmongod 流程
  • 终止正在运行的操作
  • 旋转日志文件
  • 数据中心意识
  • MongoDB 部署中的工作负载隔离
  • Zones
  • Management 碎片区
  • 按位置细分数据
  • 用于更改 SLA 或 SLO 的分层硬件
  • 按应用或 Client 细分数据
  • 仅插入工作负载的分布式本地写入
  • Management 碎片区
  • MongoDB 备份方法
  • 使用文件系统快照备份和还原
  • 使用 MongoDB 工具备份和还原
  • 从 MongoDB 备份还原副本集
  • 备份和还原分片群集
  • 使用文件系统快照备份分片群集
  • 使用数据库转储备份分片群集
  • 计划分片群集的备份窗口
  • 还原分片群集
  • 意外关闭后恢复独立服务器
  • 监控 MongoDB
  • 在 Linux 上使用 SNMP 监视 MongoDB
  • 使用 SNMP 监视 MongoDB Windows
  • Troubleshoot SNMP
  • Storage
  • Storage Engines
  • WiredTiger 存储引擎
  • 将 Standalone 更改为 WiredTiger
  • 将副本集更改为 WiredTiger
  • 将分片群集更改为 WiredTiger
  • MMAPv1 存储引擎
  • 内存中存储引擎
  • Journaling
  • Manage Journaling
  • GridFS
  • 常见问题解答:MongoDB 存储
  • 经常问的问题
  • 常见问题解答:MongoDB 基础知识
  • FAQ: Indexes
  • FAQ: Concurrency
  • 常见问题:使用 MongoDB 进行分片
  • 常见问题解答:复制和副本集
  • 常见问题解答:MongoDB 存储
  • 常见问题:MongoDB 诊断
  • Reference
  • Operators
  • 查询和投影运算符
  • 比较查询运算符
  • 逻辑查询运算符
  • 元素查询运算符
  • $exists
  • $type
  • 评估查询运算符
  • $expr
  • $jsonSchema
  • $regex
  • $text
  • $where
  • 地理空间查询运算符
  • $geoIntersects
  • $geoWithin
  • $near
  • $nearSphere
  • $center
  • $centerSphere
  • $geometry
  • $maxDistance
  • $minDistance
  • $polygon
  • $uniqueDocs
  • 数组查询运算符
  • $elemMatch (query)
  • $size
  • 按位查询运算符
  • $bitsAllClear
  • $bitsAllSet
  • $bitsAnyClear
  • $bitsAnySet
  • $comment
  • Projection Operators
  • $ (projection)
  • $elemMatch (projection)
  • $meta
  • $slice (projection)
  • Update Operators
  • site 更新操作员
  • $currentDate
  • $rename
  • $setOnInsert
  • $unset
  • 数组更新运算符
  • $ (update)
  • $[<identifier>]
  • $addToSet
  • $pull
  • $push
  • $pullAll
  • $each
  • $position
  • $slice
  • $sort
  • 按位更新运算符
  • 聚合管道阶段
  • $addFields (aggregation)
  • $bucket (aggregation)
  • $bucketAuto (aggregation)
  • $collStats (aggregation)
  • $count (aggregation)
  • $currentOp (aggregation)
  • $facet (aggregation)
  • $geoNear (aggregation)
  • $graphLookup (aggregation)
  • $group (aggregation)
  • $indexStats (aggregation)
  • $limit (aggregation)
  • $listLocalSessions
  • $listSessions
  • $lookup (aggregation)
  • $match (aggregation)
  • $out (aggregation)
  • $project (aggregation)
  • $redact (aggregation)
  • $replaceRoot (aggregation)
  • $sample (aggregation)
  • $skip (aggregation)
  • $sort (aggregation)
  • $sortByCount (aggregation)
  • $unwind (aggregation)
  • 聚合管道运算符
  • $abs (aggregation)
  • $add (aggregation)
  • $addToSet (aggregation)
  • $allElementsTrue (aggregation)
  • $and (aggregation)
  • $anyElementTrue (aggregation)
  • $arrayElemAt (aggregation)
  • $arrayToObject (aggregation)
  • $avg (aggregation)
  • $ceil (aggregation)
  • $cmp (aggregation)
  • $concat (aggregation)
  • $concatArrays (aggregation)
  • $cond (aggregation)
  • $dateFromParts (aggregation)
  • $dateToParts (aggregation)
  • $dateFromString (aggregation)
  • $dateToString (aggregation)
  • $dayOfMonth (aggregation)
  • $dayOfWeek (aggregation)
  • $dayOfYear (aggregation)
  • $divide (aggregation)
  • $eq (aggregation)
  • $exp (aggregation)
  • $filter (aggregation)
  • $first (aggregation)
  • $floor (aggregation)
  • $gt (aggregation)
  • $gte (aggregation)
  • $hour (aggregation)
  • $ifNull (aggregation)
  • $in (aggregation)
  • $indexOfArray (aggregation)
  • $indexOfBytes (aggregation)
  • $indexOfCP (aggregation)
  • $isArray (aggregation)
  • $isoDayOfWeek (aggregation)
  • $isoWeek (aggregation)
  • $isoWeekYear (aggregation)
  • $last (aggregation)
  • $let (aggregation)
  • $literal (aggregation)
  • $ln (aggregation)
  • $log (aggregation)
  • $log10 (aggregation)
  • $lt (aggregation)
  • $lte (aggregation)
  • $map (aggregation)
  • $max (aggregation)
  • $mergeObjects (aggregation)
  • $meta (aggregation)
  • $min (aggregation)
  • $millisecond (aggregation)
  • $minute (aggregation)
  • $mod (aggregation)
  • $month (aggregation)
  • $multiply (aggregation)
  • $ne (aggregation)
  • $not (aggregation)
  • $objectToArray (aggregation)
  • $or (aggregation)
  • $pow (aggregation)
  • $push (aggregation)
  • $range (aggregation)
  • $reduce (aggregation)
  • $reverseArray (aggregation)
  • $second (aggregation)
  • $setDifference (aggregation)
  • $setEquals (aggregation)
  • $setIntersection (aggregation)
  • $setIsSubset (aggregation)
  • $setUnion (aggregation)
  • $size (aggregation)
  • $slice (aggregation)
  • $split (aggregation)
  • $sqrt (aggregation)
  • $stdDevPop (aggregation)
  • $stdDevSamp (aggregation)
  • $strcasecmp (aggregation)
  • $strLenBytes (aggregation)
  • $strLenCP (aggregation)
  • $substr (aggregation)
  • $substrBytes (aggregation)
  • $substrCP (aggregation)
  • $subtract (aggregation)
  • $sum (aggregation)
  • $switch (aggregation)
  • $toLower (aggregation)
  • $toUpper (aggregation)
  • $trunc (aggregation)
  • $type (aggregation)
  • $week (aggregation)
  • $year (aggregation)
  • $zip (aggregation)
  • Query Modifiers
  • $comment
  • $explain
  • $hint
  • $maxScan
  • $maxTimeMS
  • $orderby
  • $query
  • $returnKey
  • $showDiskLoc
  • $natural
  • Database Commands
  • Aggregation Commands
  • aggregate
  • count
  • distinct
  • group
  • mapReduce
  • Geospatial Commands
  • geoNear
  • geoSearch
  • 查询和写入操作命令
  • delete
  • findAndModify
  • getLastError
  • getMore
  • getPrevError
  • insert
  • parallelCollectionScan
  • resetError
  • update
  • 查询计划缓存命令
  • planCacheClear
  • planCacheClearFilters
  • planCacheListFilters
  • planCacheListPlans
  • planCacheListQueryShapes
  • planCacheSetFilter
  • Authentication Commands
  • authenticate
  • authSchemaUpgrade
  • copydbgetnonce
  • getnonce
  • logout
  • 用户 Management 命令
  • createUser
  • dropAllUsersFromDatabase
  • dropUser
  • grantRolesToUser
  • revokeRolesFromUser
  • updateUser
  • usersInfo
  • 角色 Management 命令
  • createRole
  • dropRole
  • dropAllRolesFromDatabase
  • grantPrivilegesToRole
  • grantRolesToRole
  • invalidateUserCache
  • revokePrivilegesFromRole
  • revokeRolesFromRole
  • rolesInfo
  • updateRole
  • Replication Commands
  • applyOps
  • isMaster
  • replSetAbortPrimaryCatchUp
  • replSetFreeze
  • replSetGetConfig
  • replSetGetStatus
  • replSetInitiate
  • replSetMaintenance
  • replSetReconfig
  • replSetResizeOplog
  • replSetStepDown
  • replSetSyncFrom
  • resync
  • Sharding Commands
  • addShard
  • addShardToZone
  • balancerStart
  • balancerStatus
  • balancerStop
  • checkShardingIndex
  • cleanupOrphaned
  • enableSharding
  • flushRouterConfig
  • getShardMap
  • getShardVersion
  • isdbgrid
  • listShards
  • medianKey
  • moveChunk
  • movePrimary
  • mergeChunks
  • removeShard
  • removeShardFromZone
  • setShardVersion
  • shardCollection
  • shardingState
  • split
  • splitChunk
  • splitVector
  • unsetSharding
  • updateZoneKeyRange
  • Sessions Commands
  • endSessions
  • killAllSessions
  • killAllSessionsByPattern
  • killSessions
  • refreshSessions
  • startSession
  • Administration Commands
  • clean
  • clone
  • cloneCollection
  • cloneCollectionAsCapped
  • collMod
  • compact
  • connPoolSync
  • convertToCapped
  • copydb
  • create
  • createIndexes
  • currentOp
  • dropDatabase
  • dropIndexes
  • filemd5
  • fsync
  • fsyncUnlock
  • getParameter
  • killCursors
  • killOp
  • listCollections
  • listDatabases
  • listIndexes
  • logRotate
  • reIndex
  • renameCollection
  • repairDatabase
  • setFeatureCompatibilityVersion
  • setParameter
  • shutdown
  • touch
  • Diagnostic Commands
  • availableQueryOptions
  • buildInfo
  • collStats
  • connPoolStats
  • connectionStatus
  • cursorInfo
  • dataSize
  • dbHash
  • dbStats
  • diagLogging
  • driverOIDTest
  • explain
  • features
  • getCmdLineOpts
  • getLog
  • hostInfo
  • isSelf
  • listCommands
  • netstat
  • profile
  • serverStatus
  • shardConnPoolStats
  • validate
  • whatsmyuri
  • 系统事件审核命令
  • logApplicationMessage
  • mongo Shell 方法
  • Collection Methods
  • db.collection.aggregate()
  • db.collection.bulkWrite()
  • db.collection.copyTo()
  • db.collection.count()
  • db.collection.createIndex()
  • db.collection.createIndexes()
  • db.collection.dataSize()
  • db.collection.deleteOne()
  • db.collection.deleteMany()
  • db.collection.distinct()
  • db.collection.drop()
  • db.collection.dropIndex()
  • db.collection.dropIndexes()
  • db.collection.ensureIndex()
  • db.collection.explain()
  • db.collection.find()
  • db.collection.findAndModify()
  • db.collection.findOne()
  • db.collection.findOneAndDelete()
  • db.collection.findOneAndReplace()
  • db.collection.findOneAndUpdate()
  • db.collection.getIndexes()
  • db.collection.getShardDistribution()
  • db.collection.getShardVersion()
  • db.collection.group()
  • db.collection.insert()
  • db.collection.insertOne()
  • db.collection.insertMany()
  • db.collection.isCapped()
  • db.collection.latencyStats()
  • db.collection.mapReduce()
  • db.collection.reIndex()
  • db.collection.remove()
  • db.collection.renameCollection()
  • db.collection.replaceOne()
  • db.collection.save()
  • db.collection.stats()
  • db.collection.storageSize()
  • db.collection.totalIndexSize()
  • db.collection.totalSize()
  • db.collection.update()
  • db.collection.updateOne()
  • db.collection.updateMany()
  • db.collection.watch()
  • db.collection.validate()
  • Cursor Methods
  • cursor.addOption()
  • cursor.allowPartialResults()
  • cursor.batchSize()
  • cursor.close()
  • cursor.isClosed()
  • cursor.collation()
  • cursor.comment()
  • cursor.count()
  • cursor.explain()
  • cursor.forEach()
  • cursor.hasNext()
  • cursor.hint()
  • cursor.isExhausted()
  • cursor.itcount()
  • cursor.limit()
  • cursor.map()
  • cursor.max()
  • cursor.maxScan()
  • cursor.maxTimeMS()
  • cursor.min()
  • cursor.next()
  • cursor.noCursorTimeout()
  • cursor.objsLeftInBatch()
  • cursor.pretty()
  • cursor.readConcern()
  • cursor.readPref()
  • cursor.returnKey()
  • cursor.showRecordId()
  • cursor.size()
  • cursor.skip()
  • cursor.sort()
  • cursor.tailable()
  • cursor.toArray()
  • Database Methods
  • db.adminCommand()
  • db.aggregate()
  • db.cloneCollection()
  • db.cloneDatabase()
  • db.commandHelp()
  • db.copyDatabase()
  • db.createCollection()
  • db.createView()
  • db.currentOp()
  • db.dropDatabase()
  • db.eval()
  • db.fsyncLock()
  • db.fsyncUnlock()
  • db.getCollection()
  • db.getCollectionInfos()
  • db.getCollectionNames()
  • db.getLastError()
  • db.getLastErrorObj()
  • db.getLogComponents()
  • db.getMongo()
  • db.getName()
  • db.getPrevError()
  • db.getProfilingLevel()
  • db.getProfilingStatus()
  • db.getReplicationInfo()
  • db.getSiblingDB()
  • db.help()
  • db.hostInfo()
  • db.isMaster()
  • db.killOp()
  • db.listCommands()
  • db.logout()
  • db.printCollectionStats()
  • db.printReplicationInfo()
  • db.printShardingStatus()
  • db.printSlaveReplicationInfo()
  • db.repairDatabase()
  • db.resetError()
  • db.runCommand()
  • db.serverBuildInfo()
  • db.serverCmdLineOpts()
  • db.serverStatus()
  • db.setLogLevel()
  • db.setProfilingLevel()
  • db.shutdownServer()
  • db.stats()
  • db.version()
  • 查询计划缓存方法
  • db.collection.getPlanCache()
  • PlanCache.clear()
  • PlanCache.clearPlansByQuery()
  • PlanCache.getPlansByQuery()
  • PlanCache.help()
  • PlanCache.listQueryShapes()
  • 批量操作方法
  • db.collection.initializeOrderedBulkOp()
  • db.collection.initializeUnorderedBulkOp()
  • Bulk()
  • Bulk.execute()
  • Bulk.find()
  • Bulk.find.arrayFilters()
  • Bulk.find.collation()
  • Bulk.find.remove()
  • Bulk.find.removeOne()
  • Bulk.find.replaceOne()
  • Bulk.find.updateOne()
  • Bulk.find.update()
  • Bulk.find.upsert()
  • Bulk.getOperations()
  • Bulk.insert()
  • Bulk.tojson()
  • Bulk.toString()
  • 用户 Management 方法
  • db.auth()
  • db.changeUserPassword()
  • db.createUser()
  • db.dropUser()
  • db.dropAllUsers()
  • db.getUser()
  • db.getUsers()
  • db.grantRolesToUser()
  • db.removeUser()
  • db.revokeRolesFromUser()
  • db.updateUser()
  • 角色 Management 方法
  • db.createRole()
  • db.dropRole()
  • db.dropAllRoles()
  • db.getRole()
  • db.getRoles()
  • db.grantPrivilegesToRole()
  • db.revokePrivilegesFromRole()
  • db.grantRolesToRole()
  • db.revokeRolesFromRole()
  • db.updateRole()
  • Replication Methods
  • rs.add()
  • rs.addArb()
  • rs.conf()
  • rs.freeze()
  • rs.help()
  • rs.initiate()
  • rs.printReplicationInfo()
  • rs.printSlaveReplicationInfo()
  • rs.reconfig()
  • rs.remove()
  • rs.status()
  • rs.stepDown()
  • rs.syncFrom()
  • Sharding Methods
  • sh.addShard()
  • sh.addShardTag()
  • sh.addShardToZone()
  • sh.addTagRange()
  • sh.disableBalancing()
  • sh.enableBalancing()
  • sh.disableAutoSplit
  • sh.enableAutoSplit
  • sh.enableSharding()
  • sh.getBalancerHost()
  • sh.getBalancerState()
  • sh.removeTagRange()
  • sh.removeRangeFromZone()
  • sh.help()
  • sh.isBalancerRunning()
  • sh.moveChunk()
  • sh.removeShardTag()
  • sh.removeShardFromZone()
  • sh.setBalancerState()
  • sh.shardCollection()
  • sh.splitAt()
  • sh.splitFind()
  • sh.startBalancer()
  • sh.status()
  • sh.stopBalancer()
  • sh.waitForBalancer()
  • sh.waitForBalancerOff()
  • sh.waitForPingChange()
  • sh.updateZoneKeyRange()
  • 对象构造器和方法
  • BulkWriteResult()
  • Date()
  • ObjectId
  • ObjectId.getTimestamp()
  • ObjectId.toString()
  • ObjectId.valueOf()
  • UUID()
  • WriteResult()
  • WriteResult.hasWriteError()
  • WriteResult.hasWriteConcernError()
  • Connection Methods
  • connect()
  • Mongo()
  • Mongo.getDB()
  • Mongo.getReadPrefMode()
  • Mongo.getReadPrefTagSet()
  • Mongo.isCausalConsistency()
  • Mongo.setCausalConsistency()
  • Mongo.setReadPref()
  • Mongo.startSession()
  • Session
  • SessionOptions
  • Native Methods
  • cat()
  • copyDbpath()
  • getHostName()
  • getMemInfo()
  • hostname()
  • listFiles()
  • load()
  • md5sumFile()
  • mkdir()
  • pwd()
  • quit()
  • removeFile()
  • resetDbpath()
  • sleep()
  • setVerboseShell()
  • version()
  • _isWindows()
  • _rand()
  • MongoDB 软件包组件
  • mongod
  • mongos
  • mongo
  • mongod.exe
  • mongos.exe
  • mongodump
  • mongorestore
  • bsondump
  • mongoimport
  • mongoexport
  • mongostat
  • mongotop
  • mongoperf
  • mongoreplay
  • mongoldap
  • mongofiles
  • install_compass
  • 配置文件选项
  • MongoDB 服务器参数
  • MongoDB 限制和阈值
  • Explain Results
  • System Collections
  • 连接字符串 URI 格式
  • Collation
  • 排序规则语言环境和默认参数
  • MongoDB Wire 协议
  • Log Messages
  • 退出代码和状态
  • Glossary
  • 默认的 MongoDB 端口
  • Server Sessions
  • Release Notes
  • MongoDB 3.6 发行说明
  • 3.6 Changelog
  • MongoDB 3.6 中的兼容性更改
  • 将独立版本升级到 3.6
  • 将副本集升级到 3.6
  • 将分片群集升级到 3.6
  • 将 3.6 独立降级到 3.4
  • 降级 3.6 复制副本设置为 3.4
  • 将 3.6 分片集群降级到 3.4
  • MongoDB 3.4 发行说明
  • 3.4 Changelog
  • MongoDB 3.4 中的兼容性更改
  • 将独立版升级到 3.4
  • 将副本集升级到 3.4
  • 将分片群集升级到 3.4
  • 将 MongoDB 3.4 降级到 3.2
  • 将 3.4 独立降级到 3.2
  • 降级 3.4 副本设置为 3.2
  • 将 3.4 分片集群降级到 3.2
  • MongoDB 3.2 发行说明
  • 3.2 Changelog
  • MongoDB 3.2 中的兼容性更改
  • MongoDB 3.2 中的 JavaScript 更改
  • 将 MongoDB 升级到 3.2
  • 从 3.2 降级 MongoDB
  • MongoDB 3.0 发行说明
  • 3.0 Changelog
  • MongoDB 3.0 中的兼容性更改
  • 将 MongoDB 升级到 3.0
  • 升级到 SCRAM
  • 从 3.0 降级 MongoDB
  • MongoDB 2.6 发行说明
  • 2.6 Changelog
  • MongoDB 2.6 中的兼容性更改
  • 将 MongoDB 升级到 2.6
  • 将用户授权数据升级到 2.6 格式
  • 从 2.6 降级 MongoDB
  • MongoDB 2.4 发行说明
  • 2.4 Changelog
  • MongoDB 2.4 中的 JavaScript 更改
  • 将 MongoDB 升级到 2.4
  • MongoDB 2.4 中的兼容性和索引类型更改
  • MongoDB 2.2 发行说明
  • MongoDB 2.0 发行说明
  • MongoDB 1.8 发行说明
  • MongoDB 1.6 发行说明
  • MongoDB 1.4 发行说明
  • MongoDB 1.2.x 发行说明
  • MongoDB Versioning
  • Technical Support
  • 对于每个匹配的文档, $graphLookup connectFromField 的值,并在 from 集合中的每个文档中检查匹配的 connectToField 值。对于每个匹配项, $graphLookup from 集合中的匹配文档添加到由 as 参数命名的数组字段中。

    此步骤以递归方式 continue 进行,直到找不到更多匹配的文档,或者直到操作达到 maxDepth 参数指定的递归深度为止。然后 $graphLookup 将数组字段追加到 Importing 文档中。 $graphLookup 完成对所有 Importing 文档的搜索后返回结果。

    $graphLookup 具有以下原型形式:

    $graphLookup: { from: <collection>, startWith: <expression>, connectFromField: <string>, connectToField: <string>, as: <string>, maxDepth: <number>, depthField: <string>, restrictSearchWithMatch: <document>

    $graphLookup 接收包含以下字段的文档:

    FieldDescription from $graphLookup 操作要搜索的目标集合,将 connectFromField connectToField 递归匹配。不能对 from 集合进行分片,并且必须与该操作中使用的任何其他集合位于同一数据库中。有关信息,请参见 Sharded Collections startWith Expression 指定用于开始递归搜索的 connectFromField 的值。可选地, startWith 可以是值的数组,每个值都分别经过遍历过程。 connectFromField $graphLookup 用于与集合中其他文档的 connectToField 递归匹配的字段名称。如果值是数组,则每个元素都将分别经过遍历过程。 connectToField 其他文档中与 connectFromField 参数指定的字段值相匹配的字段名。 as 添加到每个输出文档中的数组字段的名称。包含在 $graphLookup 阶段遍历的文档。

    Note





    不能保证在 as 字段中返回的文档以任何 Sequences 排列。



    |
    | maxDepth | *可选.*非负整数,指定最大递归深度。
    | depthField | *可选.*要添加到搜索路径中每个已遍历文档的字段名称。该字段的值是文档的递归深度,表示为 NumberLong 。递归深度值从零开始,因此第一次查找对应于零深度。
    | restrictSearchWithMatch | *可选.*为递归搜索指定其他条件的文档。语法与 query filter 语法相同。

    > [!NOTE|label:Note]




    您不能在此过滤器中使用任何 aggregation expression 。例如,查询文档如





    { lastName: { $ne: "$lastName" } }





    在这种情况下将无法找到 lastName 值与 Importing 文档的 lastName 值不同的文档,因为 "$lastName" 将充当字符串 Literals,而不是字段路径。



    |

    Considerations

    Sharded Collections

    from 中指定的集合不能为 sharded 。但是,可以对运行 aggregate() 方法的集合进行分片。也就是说,在下面:

    db.collection.aggregate([
       { $graphLookup: { from: "fromCollection", ... } }
    

    collection可以被分片。

    fromCollection无法分片。

    要加入多个分片集合,请考虑:

    修改 Client 端应用程序以执行手动查找,而不是使用$graphLookup聚合阶段。

    如果可能,请使用嵌入式数据模型消除加入集合的需要。

    Max Depth

    maxDepth字段设置为0等效于非递归$graphLookup搜索阶段。

    Memory

    $graphLookup阶段必须保持在 100 MiB 内存限制内。如果为aggregate()操作指定了allowDiskUse: true,则$graphLookup阶段将忽略该选项。如果在aggregate()操作中还有其他观察allowDiskUse: true的阶段,则allowDiskUse: true选项对这些其他阶段有效。

    有关更多信息,请参见聚集管线限制

    视图和排序规则

    如果执行涉及多个视图的聚合(例如$lookup$graphLookup),则这些视图必须具有相同的collation

    Examples

    在一个集合内

    名为employees的集合具有以下文档:

    { "_id" : 1, "name" : "Dev" }
    { "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" }
    { "_id" : 3, "name" : "Ron", "reportsTo" : "Eliot" }
    { "_id" : 4, "name" : "Andrew", "reportsTo" : "Eliot" }
    { "_id" : 5, "name" : "Asya", "reportsTo" : "Ron" }
    { "_id" : 6, "name" : "Dan", "reportsTo" : "Andrew" }
    

    以下$graphLookup操作在employees集合中的reportsToname字段上递归匹配,返回每个人的报告层次结构:

    db.employees.aggregate( [
          $graphLookup: {
             from: "employees",
             startWith: "$reportsTo",
             connectFromField: "reportsTo",
             connectToField: "name",
             as: "reportingHierarchy"
    

    该操作返回以下内容:

    "_id" : 1, "name" : "Dev", "reportingHierarchy" : [ ] "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev", "reportingHierarchy" : [ { "_id" : 1, "name" : "Dev" } "_id" : 3, "name" : "Ron", "reportsTo" : "Eliot", "reportingHierarchy" : [ { "_id" : 1, "name" : "Dev" }, { "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" } "_id" : 4, "name" : "Andrew", "reportsTo" : "Eliot", "reportingHierarchy" : [ { "_id" : 1, "name" : "Dev" }, { "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" } "_id" : 5, "name" : "Asya", "reportsTo" : "Ron", "reportingHierarchy" : [ { "_id" : 1, "name" : "Dev" }, { "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" }, { "_id" : 3, "name" : "Ron", "reportsTo" : "Eliot" } "_id" : 6, "name" : "Dan", "reportsTo" : "Andrew", "reportingHierarchy" : [ { "_id" : 1, "name" : "Dev" }, { "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" }, { "_id" : 4, "name" : "Andrew", "reportsTo" : "Eliot" }

    下表提供了文档{ "_id" : 5, "name" : "Asya", "reportsTo" : "Ron" }的遍历路径:

    起始值文档的reportsTo值:
    { ... "reportsTo" : "Ron" } Depth 0{ "_id" : 3, "name" : "Ron", "reportsTo" : "Eliot" } Depth 1{ "_id" : 2, "name" : "Eliot", "reportsTo" : "Dev" } Depth 2{ "_id" : 1, "name" : "Dev" }

    输出生成层次结构Asya -> Ron -> Eliot -> Dev

    跨多个收藏集

    $lookup一样,$graphLookup可以访问同一数据库中的另一个集合。

    在以下示例中,数据库包含两个集合:

  • 具有以下文档的集合airports
  • { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ] }
    { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ] }
    { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ] }
    { "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ] }
    { "_id" : 4, "airport" : "LHR", "connects" : [ "PWM" ] }
    
  • 具有以下文档的集合travelers
  • { "_id" : 1, "name" : "Dev", "nearestAirport" : "JFK" }
    { "_id" : 2, "name" : "Eliot", "nearestAirport" : "JFK" }
    { "_id" : 3, "name" : "Jeff", "nearestAirport" : "BOS" }
    

    对于travelers集合中的每个文档,以下聚合操作将查找airports集合中的nearestAirport值,并将connects字段与airport字段递归匹配。该操作将最大递归深度指定为2

    db.travelers.aggregate( [
          $graphLookup: {
             from: "airports",
             startWith: "$nearestAirport",
             connectFromField: "connects",
             connectToField: "airport",
             maxDepth: 2,
             depthField: "numConnections",
             as: "destinations"
    

    该操作返回以下结果:

    "_id" : 1, "name" : "Dev", "nearestAirport" : "JFK", "destinations" : [ { "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(2) }, { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(1) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(0) } "_id" : 2, "name" : "Eliot", "nearestAirport" : "JFK", "destinations" : [ { "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(2) }, { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(1) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(0) } ] "_id" : 3, "name" : "Jeff", "nearestAirport" : "BOS", "destinations" : [ { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK" ], "numConnections" : NumberLong(2) }, { "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ], "numConnections" : NumberLong(1) }, { "_id" : 4, "airport" : "LHR", "connects" : [ "PWM" ], "numConnections" : NumberLong(2) }, { "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ], "numConnections" : NumberLong(1) }, { "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM" ], "numConnections" : NumberLong(0) }

    下表提供了递归搜索的遍历路径,深度为2,起始airportJFK

    起始值来自travelers集合的nearestAirport值:
    { ... "nearestAirport" : "JFK" } Depth 0{ "_id" : 0, "airport" : "JFK", "connects" : [ "BOS", "ORD" ] } Depth 1{ "_id" : 1, "airport" : "BOS", "connects" : [ "JFK", "PWM"] }
    { "_id" : 2, "airport" : "ORD", "connects" : [ "JFK"] } Depth 2{ "_id" : 3, "airport" : "PWM", "connects" : [ "BOS", "LHR" ] }

    使用查询过滤器

    下面的示例使用一个集合,该集合包含一组文档,其中包含人的名字以及他们的朋友和爱好的数组。聚集操作找到一个特定的人,并遍历她的联系网络,以找到在他们的兴趣中列出golf的人。

    名为people的集合包含以下文档:

    "_id" : 1, "name" : "Tanya Jordan", "friends" : [ "Shirley Soto", "Terry Hawkins", "Carole Hale" ], "hobbies" : [ "tennis", "unicycling", "golf" ] "_id" : 2, "name" : "Carole Hale", "friends" : [ "Joseph Dennis", "Tanya Jordan", "Terry Hawkins" ], "hobbies" : [ "archery", "golf", "woodworking" ] "_id" : 3, "name" : "Terry Hawkins", "friends" : [ "Tanya Jordan", "Carole Hale", "Angelo Ward" ], "hobbies" : [ "knitting", "frisbee" ] "_id" : 4, "name" : "Joseph Dennis", "friends" : [ "Angelo Ward", "Carole Hale" ], "hobbies" : [ "tennis", "golf", "topiary" ] "_id" : 5, "name" : "Angelo Ward", "friends" : [ "Terry Hawkins", "Shirley Soto", "Joseph Dennis" ], "hobbies" : [ "travel", "ceramics", "golf" ] "_id" : 6, "name" : "Shirley Soto", "friends" : [ "Angelo Ward", "Tanya Jordan", "Carole Hale" ], "hobbies" : [ "frisbee", "set theory" ]

    以下聚合操作分为三个阶段:

    $match与包含字符串"Tanya Jordan"name字段的文档匹配。返回一个输出文档。

    $graphLookup将输出文档的friends字段与集合中其他文档的name字段连接,以遍历Tanya Jordan's连接网络。此阶段使用restrictSearchWithMatch参数仅查找hobbies数组包含golf的文档。返回一个输出文档。

    $project对输出文档进行整形。 connections who play golf中列出的名称取自 Importing 文档golfers数组中列出的文档的name字段。

    db.people.aggregate( [
      { $match: { "name": "Tanya Jordan" } },
      { $graphLookup: {
          from: "people",
          startWith: "$friends",
          connectFromField: "friends",
          connectToField: "name",
          as: "golfers",
          restrictSearchWithMatch: { "hobbies" : "golf" }
      { $project: {
          "name": 1,
          "friends": 1,
          "connections who play golf": "$golfers.name"
    

    该操作返回以下文档:

    "_id" : 1, "name" : "Tanya Jordan", "friends" : [ "Shirley Soto", "Terry Hawkins", "Carole Hale" "connections who play golf" : [ "Joseph Dennis", "Tanya Jordan", "Angelo Ward", "Carole Hale"

    Additional Resource

    网络研讨会:在 MongoDB 中使用图数据