Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1036555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:43:25+00:00 2026-05-16T14:43:25+00:00

CouchDB is convenient to develop (CouchApps) locally and then push into remote production. Unfortunately

  • 0

CouchDB is convenient to develop (CouchApps) locally and then push into remote production. Unfortunately with production-sized data sets, working on views can be cumbersome.

What are good ways to take samples of a CouchDB database for use in local development?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:43:26+00:00Added an answer on May 16, 2026 at 2:43 pm

    The answer is filtered replication. I like to do this in two parts:

    1. Replicate the production database, example_db to my local server as example_db_full
    2. Perform filtered replication from example_db_full to example_db, where the filter cuts out enough data so builds are fast, but keeps enough data so I can confirm my code works.

    Which documents to select can be application-specific. At this time, I am satisfied with a simple random pass/fail with a percentage that I can specify. The randomness is consistent (i.e., the same document always passes or always fails.)

    My technique is to normalize the content checksum in the document _rev field on a range of [0.0, 1.0). Then I simply specify some fraction (e.g. 0.01), and if the normalized checksum value is <= my fraction, the document passes.

    function(doc, req) {
      if(/^_design\//.test(doc._id))
        return true;
    
      if(!req.query.p)
        throw {error: "Must supply a 'p' parameter with the fraction"
                      + " of documents to pass [0.0-1.0]"};
    
      var p = parseFloat(req.query.p);
      if(!(p >= 0.0 && p <= 1.0)) // Also catches NaN
        throw {error: "Must supply a 'p' parameter with the fraction of documents"
                      + " to pass [0.0-1.0]"};
    
      // Consider the first 8 characters of the doc checksum (for now, taken
      // from _rev) as a real number on the range [0.0, 1.0), i.e.
      // ["00000000", "ffffffff").
      var ONE = 4294967295; // parseInt("ffffffff", 16);
      var doc_val = parseInt(doc._rev.match(/^\d+-([0-9a-f]{8})/)[1], 16);
    
      return doc_val <= (ONE * p);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project that is going to use CouchDB for flexible
I was looking into the possibility of using CouchDB. I heard that it was
I've got ~15k rows in MSSQL 2005 that I want to migrate into CouchDB,
I am already excited about document databases and especially about CouchDB's simplicity. But I
In CouchDB you always have to use map reduce to query results. In MongoDB
I have a CouchDB instance running on one machine, and thus with its own
I became interested in CouchDB recently and wanted to try and form a small
I'm new to CouchDB and want to give it a try. But before I
I'm wondering if serving documents from couchDB directly is an actual typical real world
I recently encountered a situation where my CouchDB instance used all available disk space

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.