class UserMongo(models.Model):
_id = models.ObjectIdField(primary_key=True, db_column='_id')
username = models.CharField(max_length=25)
email = models.EmailField()
password = models.CharField(max_length=25)
objects = UserMongoManager()
def __str__(self):
return "{} {}".format(self._id, self.username)
And this what I get when creating the object from postman:
{
"_id": 27,
"username": "user13",
"password": "password13"
}
In compass I see this data:
{
"_id": {
"$oid": "6232240214afce2f3a4c0e13"
},
"id": 27,
"username": "user13",
"email": "use...@mail.com",
"password": "password13"
}