Update database.py

Update set_metadata to check that "_id" is in document before attempting to delete it.
Merge pull request #5 from markbahnman/master

Bugfix for initializing the db