Skip to content

Commit

Permalink
Use MongoDB collection.replace_one() instead of deprecated collection…
Browse files Browse the repository at this point in the history
….save()
  • Loading branch information
JWCook committed Feb 23, 2021
1 parent 07e5981 commit 56b4bd3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiohttp_client_cache/backends/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ async def values(self) -> Iterable[ResponseOrKey]:
raise NotImplementedError

async def write(self, key: str, item: ResponseOrKey):
self.collection.save({'_id': key, 'data': item})
doc = {'_id': key, 'data': item}
self.collection.replace_one({'_id': key}, doc, upsert=True)


class MongoDBPickleCache(MongoDBCache):
Expand Down

0 comments on commit 56b4bd3

Please sign in to comment.