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 9120695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:40:54+00:00 2026-06-17T05:40:54+00:00

In my couchDB database I have a filter which only emits documents that have

  • 0

In my couchDB database I have a filter which only emits documents that have doc.my_key == "value" like so:

{
  "id": "_design/test".
  "filters": {
    "value_only": "function(doc){return (doc['my_key'] == 'value');}"
  }
}

When I write two documents like this:

{
  "id": 1,
  "my_key": "cheeky"
}

{
  "id":2,
  "my_key": "value"
}

Then the json at /this_database/_changes?filter=test/value_only reads:

{
  "results":[
    {"seq":2,"id":"2","changes":[{"rev":"1-463e18b34dfa529dd9b39981ad3293f4"}]},
  ],
  "last_seq":4
}

This is cool. CouchDB is cool. However I now update document #2 like this:

{
  "id":2,
  "my_key": "no longer value"
}

The filtered changes feed is now empty. I know that this is because when a document is updated previous seq numbers for that document are removed from the changes feed, but are there any parameters I can pass/configuration edits I can make so that I am returned the most recently emitted revision of that document’s ID?

  • 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-06-17T05:40:55+00:00Added an answer on June 17, 2026 at 5:40 am

    Suddenly, there is no such parameter for changes feed. The only way you may handle all changes events is to listen feed as continuous stream. However, even this case couldn’t give you any warranty that received revision number will be available due to race condition with compaction operation.

    The changes feed emits only leafs revisions and the winning ones if there was any conflicts(e.g. document has two “heads” with different leaf revision). For latter ones you may pass ?style=all_docs query argument to retrieve all existed leafs for document.

    For example:

    + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    ' Document with _id foo                                             '
    '                                                                   '
    ' +-----------------+       +-------+       +-------+     +-------+ '
    ' |      1-abc      | ----> | 2-cde | ----> | 3-fgh | --> | 4-ijk | '
    ' +-----------------+       +-------+       +-------+     +-------+ '
    '                             |                                     '
    + - - - - - - - - - - - -     |         - - - - - - - - - - - - - - +
                              '   |       '
                              '   |       '
                              '   v       '
                              ' +-------+ '
                              ' | 3-123 | '
                              ' +-------+ '
                              '           '
                              + - - - - - +
    

    The default behaviour (style=main_only) will yield the winning revision: 4-ijk, while with style=all_docs the changes feed yields both 3-123 and 4-ijk revisions for this document.

    Not sure in, but I suppose that is optimized usage of database data structure and protection against conflicts with compaction which handles all non leafs revisions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CouchDB database (v1.2.0) with documents like: { _id: pages/1, _rev: 15-56ad5a5e879206edb04a7a62105dd25d,
I have a large set of documents in a CouchDB database that were just
Given that I have some number of documents in my CouchDB database, I would
i have a database in couchdb which contain 4 documents... here the sample and
I have create CouchDB database with documents that have slash (/) in the document
I have a python program that accesses a couchDB database, creates new documents and
I have a CouchDB database in production. One of the documents has been edited
I have a couchdb database containing different types of documents. Unfortunately some of those
I have a couchdb database which stores articles. I forgot storing the creation date
Let's say I have blog entries like these in my CouchDB database: {name:Mary, postdate:20110412,

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.