Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Is frequency capping algorithm possible with map/reduce?

No replies
  • Login or register to post comments
Wed, 02/27/2013 - 11:10
extesy
Offline
Joined: 10/11/2012
Groups: None

I have a problem with creating a map/reduce algorithm in CouchBase. Let's assume my documents have three fields: user_id, time and qualifier.

I need to count all qualified users (simple field equality check), but capping the number of user_id occurrences within each hour. For example, if some user appears 100 times in the same hour, but limit is set to 10, then only 10 occurrences should count. So essentially it's a three-stage algorithm:

1. Group all qualified users by user_id and timestamp rounded down to the whole hour.
2. Reduce each group by counting and then apply the cap.
3. Sum all counts from all groups into a single number.

There are two problems here: how to pass the limit to the view and how to actually implement the cap?

Top
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker