I have two databases in CouchDB - DB1's documents are user data - name, email address, username, password but within one field that I store a list of the ID's saved in DB2 where user projects are saved (containing a username field and some Textfields.
Example DB1 Document (Users)
{
"_id": "bobsmith1000",
"_rev": "83-1e00173cac0e736c9988d3addac403de",
"first_name": "Bob",
"password": "$2a$12$sdZUkkyDnDePQFNarTTgyuUZS6DL13JvBk/k9iUa5jh08gWAS5hpm",
"second_name": "Smith",
"urls": null,
"email": "[email protected]",
"projects": [
"ee5ccf56da22121fd71d892dbe051746",
"ee5ccf56da22121fd71d892dbe0526bb",
"ee5ccf56da22121fd71d892dbe053433",
"ee5ccf56da22121fd71d892dbe056c71",
"ee5ccf56da22121fd71d892dbe0579c3",
"ee5ccf56da22121fd71d892dbe05930d"
]
}
Example DB2 Document (Projects)
{
"_id": "ee5ccf56da22121fd71d892dbe05930d",
"_rev": "1-c923fbe9de82318980c7778c4c089321",
"url": "http://harkmastering.s3.amazonaws.com/testprojects/testfolder.zip",
"username": "bobsmith1000",
"time": "2010-10-29 07:13:47.377085",
"file_size": "5.2 MB"
}
I am trying to write a view in Python (using the Flask web framework and Python Couchdb library) that will check db1, grab all the project ids, and then go to db2 and in a batch way pull out the url, time, filesize for each document with matching ids so I can can place that data in a table.
I only began programming earlier this year and this involves techniques that I can only imagine. Can anyone help me find a solution?
Kind thanks