Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade pymongo to 4.7.2 #213

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/petstore-access-control/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def addPet(pet):
)
counter = 0
ctr = db_collection.find({}).sort([('$natural', -1)])
if not ctr.count() == 0:
if not db_collection.count_documents({}) == 0:
counter = ctr[0].get('id') + 1
record = {
"id": counter,
Expand Down
2 changes: 1 addition & 1 deletion examples/petstore-access-control/docker-compose.yaml
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed the db port in petstore-access-control differs from the db port for petstore in order to be able to run both simultaneously. If this is the case, should I also change the port for the app container?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a bad idea. However, they may always be port conflicts for any given user, regardless of what ports we use. In any case, it's a different issue and nobody requested it, so let's leave the ports as they were here (i.e., please roll back 12345 to 27017).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On another note: I think it would make sense to also upgrade MongoDB to the latest version in the docker-compose.yml files for the two example apps in this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense I'll get to changing those thanks. The reason I changed the port was because the db port is 12345 in the mock data that is used by the access control tests. Should I change the port in the mock data to 27017 instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't see your reply. I think what's in the mock data shouldn't matter, it's just a different config, any port should work. But let's keep the more standard 27017 port for the petstore apps. More generally, let's only change what's necessary in any given PR :)

Speaking of which, I didn't quite understand which unit tests failed because of the port in #214. I will comment there.

Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ services:
volumes:
- ./data/petstore-access-control/db:/data/db
ports:
- "27017:27017"
- "12345:27017"
2 changes: 1 addition & 1 deletion examples/petstore/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def addPet(pet):
)
counter = 0
ctr = db_collection.find({}).sort([('$natural', -1)])
if not ctr.count() == 0:
if not db_collection.count_documents({}) == 0:
counter = ctr[0].get('id') + 1
record = {
"id": counter,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Flask-Cors==3.0.9
Flask-PyMongo==2.3.0
pydantic==1.10.8
PyJWT==2.4.0
pymongo==3.10.1
pymongo==4.7.2
PyYAML==6.0.1
requests==2.31.0
swagger-ui-bundle==0.0.6
Expand Down
Loading