abhishekkuamr

Untitled

Sep 8th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. db.system.js.save({"_id":"some_function_name",
  2. value: function(acc, limitTime) {
  3. allAcc = {};
  4. distinct1 = [];
  5. distinct2 = [];
  6. distinct1Map = [];
  7. distinct2Map = [];
  8. db.coll1.find({fromId:{$in : acc}, p:{$in : acc}, so:{$gte : limitTime} }, {_id:0, toId:1, so:1}).sort({so : -1}).forEach(function(mess) {
  9. // some if-else operation
  10. });
  11. allAcc["u"] = distinct1Map;
  12. db.coll2.find({ so:{$gte : limitTime}, fromId:{$in : acc}}, {_id:0, toId:1, so:1}).sort({so : -1}).forEach(function(group_mess) {
  13. // some if-else operation
  14. });
  15. allAcc["g"] = distinct2Map;
  16. return allAcc;
  17. }}
Advertisement
Add Comment
Please, Sign In to add comment