Fixed write test bugs

Mongo now actually added to the database properly