在mongodb中存储嵌套数据的正确方式是什么? 我有文章申请,每篇文章属于子域和每个子域属于域。我的网站是这样的: /home -> list all domains/home/domain/subdomain -> listall my articles
/home/domain/subdomain/article -> s
Document field :title ...我需要通过db (而不是通过Ruby )获取claim_fields的所有唯一值,并为我的声明提供当前标题(这对于数千条记录来说太慢了)user = User.find(...)the same as user.claims.find(...).distinct("claim_fields.value")
但是它返回所有的claim_fields值,我需要它只返回带有我需要的<