[DOCS-7402] Indicate driver version in primer docs Created: 11/Mar/16  Updated: 27/Feb/23  Resolved: 27/Feb/23

Status: Closed
Project: Documentation
Component/s: primer
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7, docs-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.org/getting-started/python/remove/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Referrer: https://docs.mongodb.org/getting-started/python/remove/
Screen Resolution: 1280 x 1024
repo: docs
source: remove


Participants:
Days since reply: 49 weeks, 2 days ago

 Description   

Original user comment:

I suspect it's referring to a later version of pymongo than I have, but I can't see how to choose the version. I don't seem to have the delete_one() method.

We don't currently specify which version of PyMongo (or, I assume, any of the other drivers) we're using in the examples. It might be practical to indicate that you need to be on 2.9+ for the examples to work (or the equivalents for the other drivers). Some folks won't realize that they're a few drivers back.



 Comments   
Comment by John Williams [ 27/Feb/23 ]

Python 2 is no longer supported so I think this ticket has gone away

Comment by Allison Reinheimer Moore [ 11/Mar/16 ]

PyMongo 2.9 revamped the CRUD methods significantly – the delete_one method was added at that point. You can check which version of PyMongo you're using by running import pymongo and then pymongo.version from a python shell. This getting started guide uses the new CRUD methods – we do not have a version for the earlier drivers. For your case, you'd need to use the remove() method, being sure to carefully specify the document that you wish to remove, rather than the new delete_one().

You can find the PyMongo reference documentation for each version here: http://api.mongodb.org/python/.

If you wish to upgrade your PyMongo version (the new methods are pretty great), there's also a migration guide.

From our end, adding an indication of what driver version we're using seems like a good idea - I'm going to scope this ticket to address that.

Generated at Thu Feb 08 07:54:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.