Guest User

Untitled

a guest
May 16th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     getTen: (channel) ->
  2.         mapFunc = () ->
  3.             key = "#{this.ts.getFullYear()}-#{this.ts.getMonth()+1}-#{this.ts.getDate()}"
  4.             values = { count: 1 }
  5.             emit(key, values)
  6.  
  7.         reduceFunc = (key, values) ->
  8.             return date: key, count: values.length
  9.  
  10.         Karma.collection.mapReduce mapFunc.toString(), reduceFunc.toString(), { out: {inline:1}, query: {ch:channel}, sort: {$natural:-1} }, (err, val) ->
  11.             if err isnt null
  12.                 console.log('Error: ')
  13.                 console.log(err)
  14.             else
  15.                 console.log('Success: ')
  16.                 console.log(val)
Add Comment
Please, Sign In to add comment