Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2458

primary_key in relationship options?

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.10
    • Affects Version/s: None
    • Component/s: None
    • None

      Active Record allows you to specify a custom field to be used as the primary_key in a relationship. Why is this option not enabled in Mongoid?

      I have a collection storing some data which I receive from an API. I have a field called 'external_id' this field holds the primary key (id) provided by the api. This api data has relationships already defined. It would be nice if I could use the external_id as the key to find the related data.

      Example: this particular data has a parent_id field. This field holds the same id as the external_id.

      Any chance this can be included in Mongoid? If not, what is the reasoning?

            Assignee:
            Unassigned Unassigned
            Reporter:
            demersus demersus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: