Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个运行 MongoDB 的 Xserver,并且有几台计算机可以访问数据库,我想知道如何知道哪台计算机创建了每个文档。
我看到两种可能的解决方案:
1.如果您使用 mongodb ObjectId并且由于对象 id 包含有关创建它的机器的信息
机器。这是机器主机名、mac/网络地址或虚拟机 id 的 (md5) 散列的前三个字节。
您可以解析文档的 objectId 并从这三个字节中获取有关机器的信息。
2.另一种解决方案是在每个文档中保存两个机器信息。