As I was reading the CouchDB documentation I found it weird that views needed compaction while mango indexes did not. Are they not essentially the same thing and subject to the same requirement of cleaning out unused or old entries? It seems like an oversight to me.
I suppose I just need some clarification on how the index trees are different between them.
Thanks!
One may in fact compact a mango index because every index created at the
/db/_index
endpoint1 has a "ddoc" (design doc) just like the design docs for map/reduce views.Quoting from the /db/_index documentation,
Now look to the
/db/_compact/design-doc
2 endpoint's documentation**Emphasis mine
Since every "mango index" has a design-doc, it follows that any mango index may be compacted with the
/db/_compact/design-doc
endpoint.This may be verified easily with curl. Say there is a mango index with ddoc="foo-json-index-ddoc"in the "stack" database,
The verbose (succcessful) response will look like this
I left authorization out for clarity.
[1] /db/_index
[2] /db/_compact/design-doc