4 ms·
I'm only really familiar with couchdb, and implementing things like tagging are very easy. Couchdb is document based with incremental map/reduce. So for blog
by dantheman 17y ago
I'm only really familiar with couchdb, and implementing things like tagging are very easy. Couchdb is document based with incremental map/reduce. So for blog tagging, you have a blog document. That has an array of tags or even just the tags on the string.
To be able to pull up documents based on tags you can write a view that will execute map/reduce to create a list of tags and the documenets the implement them.
So document structure would look like
{
blogtext: my blog text"
tags: ["tag1", "tag2"]
}
The map function looks like:
function (doc) {
for each (tag in doc.tags)
{
emit (tag, doc._id)
}
}
That will generate a list of keys and the document ids that match. So when you execute:
http://server/db/desgindoc/_view/tags?key=tag1 http://server/db/desgindoc/_view/tags?key=tag1
you' recieve all of the documents matching that tag. You can of course do more advanced tagging, but this was just a simple example.