Consider:
from py2store import MongoStore, appendable
M = appendable(MongoStore, item2kv=lambda item: ({'_id': item.pop('_id')}, item))
m = M(db_name='py2store', collection_name='annots_example')
for item in d:
m.append(item.copy())
Ignoring the mutability of items worry, we could also write:
which would be equivalent to the loop.
But not efficient.
Instead, we could have a definition of extend that is specific to mongoDB, and uses bulk_write.