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

  • Home
  • SEARCH
  • 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 8006081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:23:47+00:00 2026-06-04T17:23:47+00:00

I am implementing a filter feature for my application and having trouble with writing

  • 0

I am implementing a filter feature for my application and having trouble with writing the view on CouchDB. While in SQL, this would be a statement with multiple join. How to replace multiple join in CouchDB. This article covers single join: http://www.cmlenz.net/archives/2007/10/couchdb-joins. However, it’s not obvious to me how to extend this approach to multiple join.

Imagine my object has a dozen properties and each property can have its individual filter. For simplicity, let’s assume it has only two properties. If we can solve that, we can probably extend it to any number of properties.

My application needs to support a bunch of AND filters. E.g. find all sessions where location in (“Seattle”, “New York”) AND start-epoch >= 1336608413. And I also need to persist filter settings.

In SQL, I have two tables: Session and Filter. Then I have one join per filter condition between Session and Filter table to get all filtered sessions.

Session Table
location    start-epoch    
Seattle     1336608413     

Filter Table
Name        Value
location    Seattle
location    New York
start-epoch 1336608413     


Query:
select * 
from Session s 
where exists (select 1 from Filter f where f.name = 'location' and f.value = s.location)
     and exists (select 1 from Filter f on f.name = 'start-epoch' and s.start-epoch >= f2.value)

In CouchDB:

{"type":"session", "location":"Seattle", "start-epoch":1336608413}

Then how to model filter and write the view?

Filter could be something like this:

{"type":"filter", "location":["Seattle", "New York"], "start-epoch":1336608413}

Then how to write the view?

I want to achieve this inside CouchDB. I am hoping to create a view called FilteredSessions and retrieve the filtered session in one http call to Couch. The reason is because I have 5 different clients (iOS, Android, Silverlight, Ruby on Rails and Windows 8) and I don’t want to rewrite the logic 5 times. If I use sqlite, I can create a view called “FilteredView” to achieve that. I hope to write the equivalent in map reduce.

  • 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-04T17:23:51+00:00Added an answer on June 4, 2026 at 5:23 pm

    Here is the idea I have. In map function, emit both session and filter documents. Then use the list function to enumerate the map output to read the persisted filters and sessions to do the filtering.

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

Sidebar

Related Questions

I am implementing a SaaS application using ASP.Net MVC 2 and SQL Server database.
How would I go about implementing a band-pass filter in c#? I'm using a
While implementing the code from this question on my project I realized there's 3
I recently got started with NHibernate and am having some trouble implementing the domain
I'm having trouble implementing render to texture with OpenGL 3. My issue is that
Keep getting this error while implementing billing. What is going on? 01-30 22:33:31.600: E/Finsky(25902):
I'm writing a grails 1.3.2 application and implementing security with spring-security-core 1.0. For reasons
implementing publishActivity in PHP using the REST API using this code: $activity = array(
is that possible to hide specific nodes in VirtualStringTree? I'm implementing filtering feature (the
I'm implementing a 'filter sweep' effect (I don't know if it's called like that).

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.