check mongodb return value for errors