3. Exporting and importing data

WordPress data is exported through the execution of page reficio_mongodb.php and imported through the command:

$ mongoimport \
    --db reficio \
    --collection pages \
    --file ./wp-content/themes/twentyseventeen/reficio.json \

which produces as output:

2018-05-15T14:16:18.280-0300    connected to: localhost
2018-05-15T14:16:18.484-0300    imported 640 documents

During data export, the creation date of the WordPress pages was assigned to the date field of type string. Let’s assign it to the  pagedate field of type date:

$ mongo
use reficio;
  page.pagedate = ISODate(page.date);


Integration of MongoDB with WordPress