Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57222

Foreign Key Constraint on field

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution

      I have been working with MongoDB for quite some time and I find that with the proper schema design, it can fit most generic use cases.

      However there are cases where referencing between collections (SQL like) is unavoidable. In these cases, the biggest drawback with Mongo compared to SQL DBs is  the foreign key constraint inability.

      Even checking using application logic, isn't 100% correct, since if you check for the validity of the field value before inserting the document, you can't be sure that it wasn't deleted when you create it and you have to check after creation and apply compensating deletion - error handling.

      I believe an index functionality where it would assert the existence of the field's value in an other's collection index  would be extremely helpful and remove this major drawback of Mongo compared to sequential databases,  since the check in the database level would allow for proper foreign key constraint.

      Tried to find similar issues - feature requests but didn't find any, that's why I created this one.

      Any thoughs on that?

       

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            dimitris_ha@hotmail.com Dimitris Halatsis
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: