I’ve got couchdb working and have a full scrape
What’s the best way to get the data out ?
I’ve got couchdb working and have a full scrape
What’s the best way to get the data out ?
I am also wondering this. I have sadly no experience with querying databases or exporting the data. I only really need each row in a JSON form and then i can parse it using Python.
I have tried the tutorial on following site which indicates using the following curl command:
curl -X GET http://127.0.0.1:5984/Bmydatabase/_all_docs?include_docs=true > /Users/[username]/Desktop/db.json
But that doesn't seem to export anything other than hashed keys and not the bits i want.
Any guidance?
Cheers,
Kris
I actually figured this out for anyone who would like to know.
First, log into your couchDB and go into your sitemap. Then, on the left, click the + next to design documents, then 'New View'. Create a function like below. the function takes each 'doc' (or row in your sitemap) and emits the following data from that row (think of this like an export)
function(doc) {
emit(doc.paginationThread, doc.Replies);
}
the emit function takes two arguments, a key and value. In this case i wanted to export the pagination thread name of a forum as the key, and the value is the replies.
Click Create Document and the Build Index
Finally run the following curl command in your terminal or command prompt
curl -X GET http://<username>:<password>@127.0.0.1:5984/<name of your sitemap>/_design/<doc name>/_view/<view name> > path-to-export-to/<filename>.json
This should export your keys and values to .json format for further analysis.
Cheers,
Kris