用 MySQL 的经验理解 MongoDB 鉴权:账号、角色与集群内部认证

从 MySQL 转到 MongoDB 的人,很少会在 CRUD 上卡住,卡住的往往是鉴权:用户明明建了,连接却报 Authentication failed;角色授了,权限却不是想象中的那样;副本集开了认证以后,节点之间互相连不上。原因多半是带着 MySQL 的心智模型去理解 MongoDB,而两者在几个关键地方并不一样。 这篇文章按 MySQL 的概念顺序,逐个对照 MongoDB 的做法,重点放在差异和容易踩的坑上。文中所有命令和输出都来自一套本地实验环境: MySQL 8.4 MongoDB 8.0.4,一个 3 节点副本集 rs0,另有一个最小的分片集群(1 个 config server、1 个分片、1 个 mongos) 两台客户端容器 client-a(172.30.0.21)和 client-b(172.30.0.22),用来演示按来源 IP 限制登录 MySQL 用的是 8.4。还在用 8.0 的话,和认证相关的主要差别有几处:8.0...

MongoDB Access Control for MySQL Users: Accounts, Roles and Internal Authentication

People who move from MySQL to MongoDB rarely get stuck on CRUD. They get stuck on access control: the user exists but the connection says Authentication failed, a role is granted but the privileges aren’t what they expected, or the...

新加坡从零考驾照全记录(2026):BTT、PDL 到路考

我在新加坡从零开始考驾照,报的是 CDC(ComfortDelGro Driving Centre)的 Class 3A,也就是自动挡小汽车。从报名到通过 BTT、拿到 PDL,一共用了 11 天。 这篇先记录到 PDL 为止,后面的实践课、FTT 和路考,考完再更新。如果你有中国驾照、打算直接转换,文末有一条容易被忽略的规定。 规定部分我都对照了新加坡警察部队(Traffic Police)的官方页面,链接放在文末。规定会调整,办理前请以官网为准。 先选路线:从零考还是转换   从零考 中国驾照转换 适合谁 没有驾照,或者手上的驾照不符合转换条件 持有有效的中国驾照 要考什么 BTT、FTT、路考 只需要 BTT 主要麻烦 步骤多,每一步都要抢预约 材料要齐,非英文驾照要找新加坡注册的翻译公司翻译 外国人在新加坡居住不满 12 个月,可以直接用有效的外国驾照开车。住满 12 个月后,就需要换成新加坡驾照。 名词解释 名词 全称 说明 TP...

Getting a Singapore Driving Licence from Scratch (2026): BTT to PDL in 11 Days

I’m learning to drive in Singapore from scratch. I enrolled for Class 3A (automatic) at CDC, the ComfortDelGro Driving Centre, and it took 11 days to go from enrolment to passing the Basic Theory Test and getting my Provisional Driving...

Building a Global Multi-Write MongoDB Cluster with Zone Sharding

Say an application has users in China and in North America. With a single replica set, the primary lives in one of the two regions, so users in the other region pay a trans-Pacific round trip, usually well over 100...