Importing Tate JSON documents into MongoDB (Linux version)
Just after the publication of the Tate metadata on GitHub, I wrote a post about how to import the JSON documents into MongoDB using a Windows command. Here I update that with how to do the same on Linux.
The command below assumes the collection has been cloned to /home/larkin/git/collection, but you should change to wherever you cloned it.
for f in $(find /home/larkin/git/collection/artists/ -name ‘*.json’); do echo “mongoimport –collection artists –file $f –db tate –jsonArray”; done > artist_import.sh
This assumes a database named “tate” in your MongoDB instance and that artists will go into an “artists” collection. For the artworks, just rename artist(s) to artwork(s).
You can run the resulting script by issuing the following command:
sh artist_import.sh
It’s not a very efficient process, but will eventually get the job done in about half an hour, give or take. I’ll follow up with further configuration of these documents and collections in MongoDB to aid searching, etc.
Leave a Reply
Want to join the discussion?Feel free to contribute!