Guest User

Untitled

a guest
Aug 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. db.mongodb.aggregate(
  2. [
  3. {
  4. "$group" : {
  5. "_id" : {
  6. "post_meta᎐country" : "$post_meta.country"
  7. },
  8. "COUNT(_id)" : {
  9. "$sum" : NumberInt(1)
  10. }
  11. }
  12. },
  13. {
  14. "$sort" : {
  15. "COUNT(_id)" : NumberInt(-1)
  16. }
  17. },
  18. {$limit: 10}
  19. ]
  20. );
  21.  
  22. aggregation <- mongodb_connection$aggregate(
  23. '[{
  24. "$group" : {"_id":"$post_meta.country",
  25. "count": {"$sum":1}
  26. }
  27. }]
  28. '
  29. )
  30.  
  31. Error: Invalid JSON object
  32.  
  33. aggregation <- mongodb_connection$aggregate(
  34.  
  35. '[{
  36. "$group" : {"_id":"$post_meta.country",
  37. "count": {"$sum":1}
  38. },
  39. {
  40. "$sort": {"count":-1}
  41. }]
  42. '
  43. )
Add Comment
Please, Sign In to add comment