Apologies if the question sounds too ambiguous, I am trying to migrate my nodes to MongoDB with the contributed MongoDB package's MongoDB Migrate module and am having trouble in migrating my node type comprising a few date and a few serialized fields where none of my field values get saved in mongo but are set as null, but are present in the MySQL table (where node_load populates the object with the respective nid when not using mongo as the storage config).

This issue, however does not occur for newly created nodes with mongo field storage and their complete data is present in the record. Only in case of migrated nodes the title and created date alone are present with all field values set to null.

I looked into the contributed module's code to identify and debug this issue. The code for migration in mongodb_migrate.drush.inc seemed elegant and fairly straightforward where the initial drush command mongodb-migrate-prepare checked for mysql fields in the field config table and updated them as mongodb field storage and prepared a list of entity types to be migrated, the second drush command mongodb-migrate gets entity data through entity_load, a record is created with an id of the nid and entity_save is performed.

Following the readme.txt I added the line

$conf['field_storage_default'] = 'mongodb_field_storage';

prior to running the migration. Logging the loaded entity object after enabling the mongo and mongo migrate modules themselves along with the above line did not seem to load the field data in my case though I did not seem to misread the ReadMe.txt

I tried to identify how the entity_load uses MySQL during the migrate and entity_save uses MongoDB for the node and fields by looking into the core's entity.inc load function and the field API's field_attach_load calls the respective storage function to load field value but could not grasp the same. Also if all nodes along with their fields are saved in a single record in MongoDB why entries would be required in MySQL's node and node_revisions is another aspect I am yet to understand. Some insight on the same would be of much help for me to understand the process and fix my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.