(mongoDB and Python) AttributeError: 'InsertManyResult' object has no attribute 'inserted_count'

If you read correctly

you will see that the return type of insert_many is of type pymongo.results.InsertManyResult which has the attributes:

  1. acknowledged

Is this the result of an acknowledged write operation?

The acknowledged attribute will be False when using WriteConcern(w=0) , otherwise True .

and

  1. inserted_ids

A list of _ids of the inserted documents, in the order provided.

There is no attribute named inserted_count, hence the error

The attribute inserted_count is only present in pymongo.results.BulkWriteResult.