update method for mongodb