quocvuongdn

#mongodb: use #aggregate and match with not_in condition

Oct 1st, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. db.user.aggregate(
  2.     {
  3.         $geoNear: {
  4.             near: [
  5.                 long_var,
  6.         lat_var
  7.             ],
  8.             distanceField: 'dist',
  9.             distanceMultiplier: 6371000,
  10.             spherical: true,
  11.             minDistance: 0,
  12.             maxDistance: maxDistance_var
  13.         }
  14.     },
  15.     {
  16.         $match : {
  17.             user_id: { $nin: [228822] }
  18.         }
  19.     },
  20.     {
  21.         $limit : 10
  22.     },
  23.     {
  24.         $skip : 0
  25.     }
  26. )
Advertisement
Add Comment
Please, Sign In to add comment