Codes for my mongodb class