Join Joseph LeBlanc for an in-depth discussion in this video Querying attachments, part of Up and Running with NoSQL Databases.
- View Offline
Once attachments have been uploaded to your CouchDB database, you'll want to be able to reference them easily. …Let's create a view to help us get all of the attachment names. …First, let's navigate to the restaurant database. …Then head over to the View dropdown, and select Temporary View. …If you have the default function that just emits null on the document, click Run. …Now, let's narrow that down to the Attachments field, add in a dot, and then underscore, …and then attachments.…
You'll notice that some of our documents don't have an attachments field, while the other ones do. …We want to have a function that only returns the documents that have attachments. …So let's go to the exercise files and get one. …Open up map.js and copy the function. …Then paste that function over the existing map function. …The ultimate goal here is to get one file name per document.…
This function is a little bit complicated, so let's step through it. …First, we are detecting whether or not the document has an attachments field. …
- What is NoSQL?
- Installing CouchDB on Mac, Windows, and Linux
- Storing data
- Nesting document data
- Specifying search criteria
- Reducing data
- Attaching and retrieving images
- Deploying applications
- Securing CouchDB
- Understanding the CAP theorem