Skip to content

Commit

Permalink
build(deps): bump some mongo-related deps
Browse files Browse the repository at this point in the history
note that mongoengine/mongomock have breaking changes.

see: https://docs.mongoengine.org/changelog.html#changes-in-0-27-0
  • Loading branch information
Bogay committed Nov 5, 2024
1 parent 72e277e commit d6a9b46
Show file tree
Hide file tree
Showing 5 changed files with 649 additions and 533 deletions.
13 changes: 12 additions & 1 deletion mongo/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
__all__ = [*mongoengine.__all__]

MONGO_HOST = os.environ.get('MONGO_HOST', 'mongomock://localhost')
connect('normal-oj', host=MONGO_HOST)

# FIXME: we should use config to check whether is in testing
if MONGO_HOST.startswith('mongomock'):
import mongomock
MONGO_HOST = MONGO_HOST.replace('mongomock', 'mongodb')
connect(
'normal-oj',
host=MONGO_HOST,
mongo_client_class=mongomock.MongoClient,
)
else:
connect('normal-oj', host=MONGO_HOST)


def handler(event):
Expand Down
Loading

0 comments on commit d6a9b46

Please sign in to comment.