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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:49:10+00:00 2026-05-26T14:49:10+00:00

I was wondering how to built a system in which users are able to

  • 0

I was wondering how to built a system in which users are able to send messages to other users. Of course everyone needs to be able to access only his inbox, so we need per-user database infrastructure for that. Following the example from http://guide.couchdb.org/draft/notifications.html, we see that users could just put the messages into the database of the recipient. Simple and effective.

But what if we do not want to allow the users to know the recipient database name? What if we want a system that will resolve the recipient’ database by looking on the to field of the message document (which could be the user name, totally unrelated to his database name):

{
    "to": "john.kowalski",
    "from": "jake.podolski",
    "subject": "hi",
    "message": "..."
}

It seems like a perfect task for additional tier, but then it would be no fun and not worth a question, so we’re gonna try and solve it with replication:

  1. User puts message document in main database
  2. Replication task (we would have a task for each user) fetches that doc using filter that filters _changes feed by to field. The name “john.kowalski” would be passed as parameter for filter function.
  3. Document ends in recipient database.

However, this creates a problem, because main database would have to be visible to all users! So…what if we would be able to add user->main replication task as well, so that the messages would be picked up from user database transferred to main database and then placed in recipients database (oh lord, it’s getting complicated, we may already waste our time by trying to solve it this way, but let’s try).

  1. User puts message document in his database
  2. Replication task fetches that doc, but can’t use filter function of any kind, because the filter in this case is owned by user, and therefore cannot be trusted.
  3. Main database validates the doc – it checks whether from field is the one that’s associated with the source database.
  4. The replication task used in previous approach transfers document to recipient.

There is problem in third step here (without that step, users would be able to send messages impersonating any other users by filling bogus info in from field) – how are we able to pass additional data to validation functions, the only parameters there as far as I know are:

  • old doc
  • new doc
  • user context (logged user name, roles, db to which document is being written)
  • security object?

By loooking on replicator database functionality introduced in 1.1.0, we could pass user_ctx context to replication task. Would it be possible for this object to contain custom data as opposed to real user info? How would that affect the standard way CouchDB handles database access?

If that would be possible, the replication task would just have the recipient name filled as parameter under user_ctx, then validation function would use that value to compare with from field. There would be no way for user to ‘send’ message as someone other than he.

  • 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-26T14:49:11+00:00Added an answer on May 26, 2026 at 2:49 pm

    This question is similar to this question about CouchDB user creation.

    As with that question, I am optimistic that my inbox database patch will make this all much nicer.

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

Sidebar

Related Questions

I'm wondering if someone has already built a system for threaded comments (for lack
I am wondering if there exists a built in class which provides a functionality
I built a simple website which allows users to post their profiles, classifieds and
I'm wondering if PHP has this optimization built in. Normally when you call foreach
Was just wondering if there are any built in functions in c++ OR c#
I'm wondering if there's a reason that there's no first(iterable) in the Python built-in
Firstly, I was wondering if there was some kind of built in function that
Is there an easy way to set up a system which will copy data
I have built a small app that has a JSlider which controls the speed
I was wondering if the most recent versions of System.Data.SQLite support the compact framework.

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.