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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:40:19+00:00 2026-05-13T06:40:19+00:00

I am new to CouchDB and learning about it. I did not come across

  • 0

I am new to CouchDB and learning about it. I did not come across CouchDB support for referential integrity.
Can we create a foreign key for a field in the CouchDB document?

For e.g. Is it possible to ensure a vendor name used in a order document is available in the vendor database?

Does CouchDB support referential integrity?
And Is it possible to make a field in a document as Primary key?

  • 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-13T06:40:19+00:00Added an answer on May 13, 2026 at 6:40 am

    No, CouchDB doesn’t do foreign keys as such, so you can’t have it handle the referential integrity of the system for you. You would need to handle checking for vendors in the application level.

    As to whether you can make a field a primary key, the primary key is the _id field, but you can use any valid json as a key for the views on the db. So, for instance you could create a view of orders with their vendor as the key.

    something like

    function(doc) {
      if (doc.type == 'order')
        emit(doc.vendor,doc);
    }
    

    would grab all the docs in the database that have a type attribute with the value order and add them to a view using their vendor as the key.

    Intro to CouchDB views

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

Sidebar

Related Questions

Disclaimer : I am reviewing CouchDB for a new project, so I am not
I'm quite new with couchdb and I want to create a view based on
When I create a new document in couchDB, I want that document to have
In CouchDB, to create a new document you send: PUT /albums/70b50bfa0a4b3aed1f8aff9e92dc16a0 Isn't PUT used
Currently I'm in the process of evaluating CouchDB for a new project. Key constraint
New to PHP and MySQL, have heard amazing things about this website from Leo
new to c#. I'm trying to make a simple system where I can search
What are the features worth learning in the 0.11 release of CouchDB? What resources
I'm new to CouchDB and document-oriented databases in general. I've been playing around with
I'm new to CouchDB, so please bear with me. I have an instance of

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.