Search code examples
phpdrupaldrupal-7drupal-modules

How are drupal field collections stored in the database?


I am trying to integrate a site made in drupal with a golang application. I just need to fetch data from the drupal site. I have database access and am trying to fetch data from the drupal site's database. However I dont understand how drupal stores field collections in the database. How can I find the field collections of a node from the drupal database?


Solution

  • When a field collection is added to a user, node, or other Drupal entity it is represented with a field type of field_collection_item. The value stored in the field_collection_item field is the id of the field collection, not the individual values of the fields making up the field_collection_item.

    Reference: https://www.drupal.org/node/1477202

    Basically it saves the field collection in the field_collection_item table and it saves all the other fields that are inside the field collection in the same convention as normal fields(their own table), except that inside the individual fields there is a bundle column inside that relates back to the field_collection_item's field_name. making a one to many relationship