用于sailsjs的mongodb mapReduce

我正在尝试根据创build时间对两个集合进行sorting。 我通过stackoverflowsearch,并find了解决scheme,这是提到这个链接http://tebros.com/2011/07/using-mongodb-mapreduce-to-join-2-collections/这是你mapReduce集合另一个名为join集合然后使用给定的参数进行sorting(在我的情况下是创build时间)。

现在的问题是我们如何在Sailsjs中进行mapReduce,我已经提到这个http://sailsjs.org/documentation/reference/waterline-orm/models/native我们有这个代码。

Pet.native(function(err, collection) { if (err) return res.serverError(err); collection.find({}, { name: true }).toArray(function (err, results) { if (err) return res.serverError(err); return res.ok(results); }); }); 

callback中的collection参数携带find,create等属性。 采集参数是否有mapReduce函数? 因为它在我的情况是不确定的。

除了打开原始连接并使用在config / connection.js(默认连接)中打开的连接之外,是否有任何方法可以在Sailsjs中使用mapReduce。

或者更好的方法来基于特定的属性来sortingMongoDB中的2个集合?

Sails v0.11.5,节点v0.4.4.2

谢谢。