I’m not sure you require the timeout or whether is would have an impact in this case. You could replace your existing code in the relevant section with just WriteConcern(w=“majority”).
Your code segments which I reviewed before redacting appear to be correct with the minor notes I made, I don’t believe they should have caused you issues but it may be worthwhile implementing the minor notes to see if they have a positive impact.
Thanks Eoin for these - I was missing one “ObjectID” on the comment update method, but everything else was correct. But didn’t change anything, still 401 errors when trying to insert, update or delete comments - as well as the other issues.
@steevej-1495 mentioned it might be that the session is not getting created properly, and I have a gut feeling he’s right. If you look at all the methods that fail, they all need a session. The only ones that work are:
- create user
- create session
- movie find methods
all which do not need a session.
Just to understand the systems at play here as I don’t see the details in the previous thread. Can you confirm what version of Python, what version of PyMongo, and what version of MongoDB is running on your Atlas cluster?
Essentially, I’d just like to rule out any session functionality issues (specifically that each of those pieces is running a release version that contains the session functionality). In terms of sessions, these are essentially handled for you by the scaffolding code so understanding your setup context will help remove that as a potential issue/s.
These are unlikely to be the cause but good practice dictates we remove these as potential causes (I think this is unlikely) and I appreciate your time in doing this diagnostic step.
Hi Eoin - here’s the requested info:
Python 3.7.4 (I had 3.8 installed initially, but reverted to an older version of Anaconda thinking that may be the issue)
As for Atlas mongodb, not sure where to look - is this the version?:
Thanks for clarifying those details, they appear to be fine. You have a version of Python that will work 3.7 with the other elements in your confirmation. Specifically, you have a version of PyMongo (3.7.2) that supports sessions, and equally a version of MongoDB (4.2.11) in your Atlas deployment that supports sessions.
If it is a 401 error, the normal cause of this is a mismatch between the username and the password. I’d suggest double checking these aspects of your code.
Falling any success after that point, then there is no easy solution.
Typically, taking a fresh copy of the M220P code and re-adding each of your earlier changes is probably the longest but surest way to detect and resolve the error. It can sometimes help to delete and restart with a fresh Atlas Cluster with a fresh load of the sample data set. This essentially returns your work to a known initial state from which you can incrementally add back in your changes. In this case, you would make the fresh copy in a different directory so you won’t lose your work to date.
Alternatively, you can walk the code path for one of those methods, I’d check for instance if the find call in find_user uses the email in the users collection. If you use an IDE like PyCharm or VS Code you can add break points at these functions to see where the error is being returned from and then work back in the code path from that point to determine the source of the error.
I’d suggest investigating your user creation and user logic as falling these aspects will generate the 401 codes.
Hope this helps and kindest regards,
Thanks Eoin. At this time I do not have the time to do that intensive of an analysis. I will just fail the 3 tickets in order to complete the course and hope I have enough correct answers to get a passing grade.
Thank you for all your help!
I appreciate your efforts and time in attempting to resolve these so I’ve credited you for those three assessments.
Awesome! Thank you very much. Have a great day, and Merry Christmas!
Sorry @brazileoin - having a problem getting the system to complete the course. Even though it says I’ve complete all the items, it won’t mark the course completed:
As well, on the Conclusion page, there is no link to get the completion certificate:
How can this be fixed?
As some of the exercises were completed by the system (by me yesterday) the generation process changes slightly such as the system itself generates the Proof of Completion and it can take up to a week’s time after the course ends.
If you wait the Proof of Completion will be generated, I’d suggest checking back in a week or two. If there is no certificate there at that point, please repost on this thread and we can investigate it.
Thanks @brazileoin - I will check back in about a week. Happy Holidays!
@brazileoin - the course is still not marked complete, and I cannot get my certificate. Can you assist with this? Thanks!
I’ve generated a certificate from you that you should be able to see on your University account now - https://university.mongodb.com/courses/M220P/2020_October_20/completion
Let me know if you have any more issues with it and thanks for taking the course!