我正在为我的组织构建一个基于 Web 的系统,使用 Mongo DB,我浏览了 mongo db 提供的文档并得出以下结论:
find: Cannot pull data from sub array.
group: Cannot work in sharded environment.
aggregate:Best for sub arrays, but has performance issue when data set is large.
Map Reduce : Too risky to write map and reduce function.
因此,如果有人可以在具有分片集群的生产环境中帮助我使用处理子数组文档的最佳方法。
例子:
{"testdata":{"studdet":[{"id","name":"xxxx","marks",80}.....]}}
现在我的“studdet”是一个巨大的集合,包含 1000 多个,每个文档的行,
所以假设我的查询是:
"Find all the "name" from "studdet" where marks is greater than 80"
它肯定会是一个聚合查询,所以在这种情况下使用聚合是否可行,因为“find”无法做到这一点,“group”在分片环境中不起作用,所以如果我使用聚合,性能会怎样影响,我大部分时间都需要调用这个查询。