Finished mongodb update function