MongoDB document's "ObjectId" instantiation and saving

I use Django + MongoDB /Djongo for backend on Windows10/VSCode. How it is to instantiate document’s “ObjectId” like it is for other field using Python? I have been struggling for a several days. Please help. Code example, below:

from datetime import date

# from django.db import models
from djongo import models

class Blog(models.Model):
    id= models.AutoField(
                auto_created = True,
                unique=True,
                primary_key = True,
                serialize = False, 
                verbose_name ='ID_nama: ')
    name = models.CharField(max_length=100)
    tagline = models.TextField()

    def __str__(self):
        return self.name

class Author(models.Model):
    name = models.CharField(max_length=200)
    email = models.EmailField()

    def __str__(self):
        return self.name

class Entry(models.Model):
    blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
    headline = models.CharField(max_length=255)
    body_text = models.TextField()
    pub_date = models.DateField()
    mod_date = models.DateField(default=date.today)
    authors = models.ManyToManyField(Author)
    number_of_comments = models.IntegerField(default=0)
    number_of_pingbacks = models.IntegerField(default=0)
    rating = models.IntegerField(default=5)

    def __str__(self):
        return self.headline

Here is the document JSON from MongodDB:

{
  "_id": {
    "$oid": "626b6627f0d91c65e9f78cc6"
  },
  "id": 5,
  "name": "Beatles Blog",
  "tagline": "Beatles tour of the Americas."
}

My target is to be able to capture the

"ObjectId" =>  "_id": {
    "$oid": "626b6627f0d91c65e9f78cc6"
}

and save it to another new field for other use/purpose.

I’ve never used Djongo (usually use pymongo) so I’m not sure if this will work/what you’re looking for, but if you need the _id value after inserting a document so you can use it elsewhere it looks like you can use Model.id after saving to get the ID value.

>>> b2 = Blog(name='Name', tagline='Tagline.')
>>> b2.id     # Returns None, because b2 doesn't have an ID yet.
>>> b2.save()
>>> b2.id

Here is the doc that has an example: Model instance reference | Django documentation | Django