Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- db.system.js.save({"_id":"some_function_name",
- value: function(acc, limitTime) {
- allAcc = {};
- distinct1 = [];
- distinct2 = [];
- distinct1Map = [];
- distinct2Map = [];
- db.coll1.find({fromId:{$in : acc}, p:{$in : acc}, so:{$gte : limitTime} }, {_id:0, toId:1, so:1}).sort({so : -1}).forEach(function(mess) {
- // some if-else operation
- });
- allAcc["u"] = distinct1Map;
- db.coll2.find({ so:{$gte : limitTime}, fromId:{$in : acc}}, {_id:0, toId:1, so:1}).sort({so : -1}).forEach(function(group_mess) {
- // some if-else operation
- });
- allAcc["g"] = distinct2Map;
- return allAcc;
- }}
Advertisement
Add Comment
Please, Sign In to add comment