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.
我正在尝试按 ruby 的 mongo 集合中的 2 个字段进行分组。我已经在 mongo 客户端中运行它,但是无法正确使用 ruby 语法。
我在 mongo 客户端上的命令是
db.truckroutes.group({key: { "route" : 0, "assetId" : "" }, reduce: function (curr, result) {}, initial: {} })
谁能给我任何想法 ruby 语法会是什么样子来执行这个命令?
先感谢您!
好的,经过一段时间的试验后设法解决了这个问题。
trucks = @mongoCollection.group( ["route", "assetId"], { }, { }, "function() {}")