i retrieve a list
of dict
which i try to insert in the database with self.db.bugzilla.insert_many(docs)
. However the documents looks to get double with each execution.
I haven't created indexes as it was suggested in other solutions to prevent publications. None of the solutions from mongodb: insert if not exists Insert_many dataframe into MongoDB and skipping duplicates issues and How to insert_many with txMongo avoiding duplicated keys? seems to fit in my case.
I read the documentation too but i still cant figure it out. I have already tried with insert_one
and update_many
. Can maybe someone help?
An example of the data looks like this
[
{
"assigned_to": "test@email.com",
"creation_time": "20211208T14:48:10",
"id": 1193534,
"assigned_to_detail": {
"email": "test@email.com",
"id": 52497,
"real_name": "john John",
"name": "test@email.com"
},
"resolution": "FIXED",
"status": "RESOLVED"
},
// {...},
// ...
]
Then, once i run the script a few times i can see the duplicated entries using db.bugzilla.find({assigned_to: 'test@email.com'})
. The only difference is the added _id.