我有一个动态嵌套字段,如 user.com1.grp1.history 哪一个 history
user.com1.grp1.history
history
样本结构:
{ _id: "123456", user: { com1: { grp1: { history: [ { action: "something", ... } ... ] }, grp2: { history: [ { action: "something else" ... } ... ] }, }, com2: { ... } } }
当我想拿到最后一件东西的时候 历史 grp
历史
grp
db.user.find({}, {user.com1.grp1.history: {$slice: -1}})
com s和 玻璃钢 user 包含许多动态 通用域名格式 包含许多动态 玻璃钢 s和我不能为他们每个人都调用query。
com
玻璃钢
user
通用域名格式
com/grp 历史 在这种情况下?
com/grp