Docs Menu

Migrate to a Later API Version

The only API version that currently exists is "1", but there will be new API versions released in the future. Upgrading your API version provides improved functionality and semantics for your application.

Some API V1 commands and behaviors will be deprecated in future versions of the MongoDB server. Deprecated commands and behaviors are typically not included in the next API version.

To migrate an existing application from API V1 to API V2, you must find and update all of the deprecated commands and behaviors features it uses.

client = MongoClient(
<connection string>,
api={"version": "1", "strict": True, "deprecationErrors": True}
)

The returns a APIDeprecationError if your application code tries to use commands and behaviors deprecated in API V1. Once your application tests pass and all deprecation errors have been fixed, you will be ready to test your application with API V2.