Replaced assert to return codes for mongodb errors
Renamed private variable to underscore