Q:

With RethinkDB, how would one implement a tag cloud? 

Suppose I have the tables (with example data):
 story
 {id: 1, name: 'First Story', tags: ['plants', 'flowers']}
 {id: 1, name: 'Second Story', tags: ['flowers', 'wedding']}

 tag
 {id: 'plants'}
 {id: 'flowers'}
 {id: 'weddings'}

The story table has a multi index on the tags field. 
Now how would I make a query that results in the amount of stories that each tag has (so it could be displayed as a tag cloud).  Ex:
 {"plants": 1, "flowers": 2, "wedding": 1}

or it could be in the format:
 [{id: "plants", count: 1}, {id: "flowers", count: 2}, {id: "wedding", count: 1}]

And do it in a performant way, where a table with hundreds of thousands of stories and hundreds of tags will complete the query quickly? 

A:

r.table("story").indexCreate("tags", {multi: true}).run(...)
r.table("story").group({index: "tags"}).count().run(...)

If you want to prettify the result of the group/count, you can do
r.table("story").group({index: "tags"}).count().ungroup().map(function(result) {
  return r.object(result("group"), result("reduction"))
})

