Map couchdb optimization