Lowercase document ids and revision ids

Changes to make sure document ids and revision ids are created with lowercase to match CouchDB.