Skip to content

Improve Onboarding with Generated System Diagrams #2356

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
68 changes: 68 additions & 0 deletions CodeBoarding/Authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
```mermaid
graph LR
Authentication_Synchronous_["Authentication (Synchronous)"]
Authentication_Asynchronous_["Authentication (Asynchronous)"]
SCRAM_Context_Synchronous_["SCRAM Context (Synchronous)"]
SCRAM_Context_Asynchronous_["SCRAM Context (Asynchronous)"]
OIDC_Authentication_Synchronous_["OIDC Authentication (Synchronous)"]
OIDC_Authentication_Asynchronous_["OIDC Authentication (Asynchronous)"]
OIDC_Authenticator_Synchronous_["OIDC Authenticator (Synchronous)"]
OIDC_Authenticator_Asynchronous_["OIDC Authenticator (Asynchronous)"]
Connection_Authentication_Synchronous_["Connection Authentication (Synchronous)"]
Connection_Authentication_Asynchronous_["Connection Authentication (Asynchronous)"]
Authentication_Synchronous_ -- "uses" --> SCRAM_Context_Synchronous_
Authentication_Asynchronous_ -- "uses" --> SCRAM_Context_Asynchronous_
Authentication_Synchronous_ -- "uses" --> OIDC_Authentication_Synchronous_
Authentication_Asynchronous_ -- "uses" --> OIDC_Authentication_Asynchronous_
OIDC_Authentication_Synchronous_ -- "uses" --> OIDC_Authenticator_Synchronous_
OIDC_Authentication_Asynchronous_ -- "uses" --> OIDC_Authenticator_Asynchronous_
OIDC_Authenticator_Synchronous_ -- "uses" --> OIDC_Context_Synchronous_
OIDC_Authenticator_Asynchronous_ -- "uses" --> OIDC_Context_Asynchronous_
Connection_Authentication_Synchronous_ -- "calls" --> Authentication_Synchronous_
Connection_Authentication_Asynchronous_ -- "calls" --> Authentication_Asynchronous_
```
[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])

## Component Details

The Authentication component is responsible for handling the authentication process with MongoDB servers. It supports various authentication mechanisms, including SCRAM, Kerberos, X.509, PLAIN, and OIDC. The component selects the appropriate authentication mechanism based on the provided credentials and server requirements. It then performs the necessary handshake procedures to establish a secure connection. The authentication process is handled differently for synchronous and asynchronous connections, but the core logic remains the same. The component interacts with connection pools to authenticate connections before they are used for database operations.

### Authentication (Synchronous)
Handles the authentication process for synchronous connections. It selects the appropriate authentication mechanism and calls the corresponding authentication function.
- **Related Classes/Methods**: `pymongo.synchronous.auth:authenticate` (full file reference), `pymongo.synchronous.auth:_authenticate_scram` (full file reference), `pymongo.synchronous.auth:_authenticate_gssapi` (full file reference), `pymongo.synchronous.auth:_authenticate_plain` (full file reference), `pymongo.synchronous.auth:_authenticate_x509` (full file reference), `pymongo.synchronous.auth:_authenticate_default` (full file reference), `pymongo.synchronous.auth:_auth_key` (full file reference), `pymongo.synchronous.auth:_canonicalize_hostname` (full file reference)

### Authentication (Asynchronous)
Handles the authentication process for asynchronous connections, mirroring the functionality of the synchronous authentication module.
- **Related Classes/Methods**: `pymongo.asynchronous.auth:authenticate` (full file reference), `pymongo.asynchronous.auth:_authenticate_scram` (full file reference), `pymongo.asynchronous.auth:_authenticate_gssapi` (full file reference), `pymongo.asynchronous.auth:_authenticate_plain` (full file reference), `pymongo.asynchronous.auth:_authenticate_x509` (full file reference), `pymongo.asynchronous.auth:_authenticate_default` (full file reference), `pymongo.asynchronous.auth:_auth_key` (full file reference), `pymongo.asynchronous.auth:_canonicalize_hostname` (full file reference)

### SCRAM Context (Synchronous)
Manages the SCRAM authentication context for synchronous connections. It initializes the context and provides a method to speculate the command for authentication.
- **Related Classes/Methods**: `pymongo.synchronous.auth._ScramContext:__init__` (full file reference), `pymongo.synchronous.auth._ScramContext:speculate_command` (full file reference)

### SCRAM Context (Asynchronous)
Manages the SCRAM authentication context for asynchronous connections. It initializes the context and provides a method to speculate the command for authentication.
- **Related Classes/Methods**: `pymongo.asynchronous.auth._ScramContext:__init__` (full file reference), `pymongo.asynchronous.auth._ScramContext:speculate_command` (full file reference)

### OIDC Authentication (Synchronous)
Handles OIDC authentication for synchronous connections. It includes functions to get the appropriate authenticator and to perform the OIDC authentication flow.
- **Related Classes/Methods**: `pymongo.synchronous.auth_oidc:_get_authenticator` (49:75), `pymongo.synchronous.auth_oidc:_authenticate_oidc` (295:303)

### OIDC Authentication (Asynchronous)
Handles OIDC authentication for asynchronous connections. It includes functions to get the appropriate authenticator and to perform the OIDC authentication flow.
- **Related Classes/Methods**: `pymongo.asynchronous.auth_oidc:_get_authenticator` (49:75), `pymongo.asynchronous.auth_oidc:_authenticate_oidc` (297:305)

### OIDC Authenticator (Synchronous)
The OIDC authenticator class for synchronous connections. It handles the details of the OIDC authentication flow, including obtaining access tokens, constructing authentication commands, and running commands against the server.
- **Related Classes/Methods**: `pymongo.synchronous.auth_oidc._OIDCAuthenticator:reauthenticate` (93:100), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:authenticate` (102:118), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:get_spec_auth_cmd` (120:124), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_authenticate_machine` (126:138), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_authenticate_human` (140:171), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_get_access_token` (173:232), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_run_command` (234:240), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_sasl_continue_jwt` (255:266), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_sasl_start_jwt` (268:272), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_get_start_command` (274:282), `pymongo.synchronous.auth_oidc._OIDCAuthenticator:_get_continue_command` (284:292)

### OIDC Authenticator (Asynchronous)
The OIDC authenticator class for asynchronous connections. It handles the details of the OIDC authentication flow, including obtaining access tokens, constructing authentication commands, and running commands against the server.
- **Related Classes/Methods**: `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:reauthenticate` (93:100), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:authenticate` (102:118), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:get_spec_auth_cmd` (120:124), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_authenticate_machine` (126:138), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_authenticate_human` (140:171), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_get_access_token` (173:232), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_run_command` (234:242), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_sasl_continue_jwt` (257:268), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_sasl_start_jwt` (270:274), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_get_start_command` (276:284), `pymongo.asynchronous.auth_oidc._OIDCAuthenticator:_get_continue_command` (286:294)

### Connection Authentication (Synchronous)
Handles authentication at the connection level for synchronous connections.
- **Related Classes/Methods**: `pymongo.synchronous.pool.Connection:authenticate` (509:541)

### Connection Authentication (Asynchronous)
Handles authentication at the connection level for asynchronous connections.
- **Related Classes/Methods**: `pymongo.asynchronous.pool.AsyncConnection:authenticate` (509:541)
66 changes: 66 additions & 0 deletions CodeBoarding/BulkWrite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
```mermaid
graph LR
AsyncBulk["AsyncBulk"]
SyncBulk["SyncBulk"]
AsyncClientBulk["AsyncClientBulk"]
SyncClientBulk["SyncClientBulk"]
BulkWriteResult["BulkWriteResult"]
ClientBulkWriteResult["ClientBulkWriteResult"]
BulkWriteError["BulkWriteError"]
ClientBulkWriteException["ClientBulkWriteException"]
Bulk_Shared_Utilities["Bulk Shared Utilities"]
Bulk_Operations["Bulk Operations"]
Bulk_Operations -- "adds operations to" --> AsyncBulk
Bulk_Operations -- "adds operations to" --> SyncBulk
AsyncBulk -- "returns result of" --> BulkWriteResult
SyncBulk -- "returns result of" --> BulkWriteResult
AsyncClientBulk -- "extends" --> AsyncBulk
SyncClientBulk -- "extends" --> SyncBulk
ClientBulkWriteResult -- "extends" --> BulkWriteResult
ClientBulkWriteException -- "extends" --> BulkWriteError
```
[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])

## Component Details

The BulkWrite component enables the execution of multiple write operations in a single batch, improving performance for scenarios involving large-scale data manipulation. It supports both ordered and unordered execution, and provides methods for adding insert, update, and delete operations. The component consists of abstract classes for synchronous and asynchronous operations, as well as client-side extensions. It interacts with other components such as Bulk Operations, BulkWriteResult, and BulkWriteError to manage the execution and results of bulk write operations.

### AsyncBulk
Implements asynchronous bulk write operations. It provides methods to add individual operations to a bulk request and then execute the entire batch asynchronously.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.asynchronous.bulk._AsyncBulk:__init__` (86:119), `mongo-python-driver.pymongo.asynchronous.bulk._AsyncBulk:add_insert` (131:137), `mongo-python-driver.pymongo.asynchronous.bulk._AsyncBulk:add_update` (139:170), `mongo-python-driver.pymongo.asynchronous.bulk._AsyncBulk:add_replace` (172:195), `mongo-python-driver.pymongo.asynchronous.bulk._AsyncBulk:execute` (727:753)

### SyncBulk
Implements synchronous bulk write operations. It provides methods to add individual operations to a bulk request and then execute the entire batch synchronously.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.synchronous.bulk._Bulk:__init__` (86:119), `mongo-python-driver.pymongo.synchronous.bulk._Bulk:add_insert` (131:137), `mongo-python-driver.pymongo.synchronous.bulk._Bulk:add_update` (139:170), `mongo-python-driver.pymongo.synchronous.bulk._Bulk:add_replace` (172:195), `mongo-python-driver.pymongo.synchronous.bulk._Bulk:execute` (725:751)

### AsyncClientBulk
Implements asynchronous client-side bulk write operations. It extends the AsyncBulk and includes additional logic for client-side operations, such as processing results from a cursor.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.asynchronous.client_bulk._AsyncClientBulk:__init__` (89:118), `mongo-python-driver.pymongo.asynchronous.client_bulk._AsyncClientBulk:add_insert` (124:133), `mongo-python-driver.pymongo.asynchronous.client_bulk._AsyncClientBulk:add_update` (135:172), `mongo-python-driver.pymongo.asynchronous.client_bulk._AsyncClientBulk:add_replace` (174:203), `mongo-python-driver.pymongo.asynchronous.client_bulk._AsyncClientBulk:execute` (728:755)

### SyncClientBulk
Implements synchronous client-side bulk write operations. It extends the SyncBulk and includes additional logic for client-side operations, such as processing results from a cursor.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.synchronous.client_bulk._ClientBulk:__init__` (89:118), `mongo-python-driver.pymongo.synchronous.client_bulk._ClientBulk:add_insert` (124:133), `mongo-python-driver.pymongo.synchronous.client_bulk._ClientBulk:add_update` (135:172), `mongo-python-driver.pymongo.synchronous.client_bulk._ClientBulk:add_replace` (174:203), `mongo-python-driver.pymongo.synchronous.client_bulk._ClientBulk:execute` (726:753)

### BulkWriteResult
Represents the result of a bulk write operation. It contains information about the number of documents inserted, updated, deleted, and matched, as well as any errors that occurred during the operation.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.results.BulkWriteResult:__init__` (265:273), `mongo-python-driver.pymongo.results.BulkWriteResult:upserted_ids` (281:286)

### ClientBulkWriteResult
Represents the result of a client-side bulk write operation. It extends the BulkWriteResult and includes additional information specific to client-side operations.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.results.ClientBulkWriteResult:__init__` (294:315), `mongo-python-driver.pymongo.results.ClientBulkWriteResult:_raise_if_not_verbose` (325:332), `mongo-python-driver.pymongo.results.ClientBulkWriteResult:insert_results` (340:347)

### BulkWriteError
Represents an error that occurred during a bulk write operation. It contains information about the error code, message, and index of the operation that failed.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.errors.BulkWriteError:__init__` (292:293), `mongo-python-driver.pymongo.errors.BulkWriteError:timeout` (299:309)

### ClientBulkWriteException
Represents an exception that occurred during a client-side bulk write operation. It extends the BulkWriteError and includes additional information specific to client-side operations, such as the partial result of the operation.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.errors.ClientBulkWriteException:__init__` (318:320), `mongo-python-driver.pymongo.errors.ClientBulkWriteException:partial_result` (353:365)

### Bulk Shared Utilities
Provides shared utility functions for bulk write operations, such as merging command documents and raising bulk write errors.
- **Related Classes/Methods**: `mongo-python-driver.pymongo._client_bulk_shared:_merge_command` (28:57), `mongo-python-driver.pymongo._client_bulk_shared:_throw_client_bulk_write_exception` (60:79), `mongo-python-driver.pymongo.bulk_shared:_merge_command` (72:113), `mongo-python-driver.pymongo.bulk_shared:_raise_bulk_write_error` (116:131)

### Bulk Operations
This component encapsulates the logic for performing bulk write operations (insert, update, delete, replace) against a MongoDB collection.
- **Related Classes/Methods**: `mongo-python-driver.pymongo.operations.InsertOne:_add_to_client_bulk` (113:122), `mongo-python-driver.pymongo.operations.DeleteOne:_add_to_bulk` (233:240), `mongo-python-driver.pymongo.operations.DeleteMany:_add_to_bulk` (294:301), `mongo-python-driver.pymongo.operations.ReplaceOne:_add_to_bulk` (387:396), `mongo-python-driver.pymongo.operations.UpdateOne:_add_to_bulk` (609:620)
19 changes: 19 additions & 0 deletions CodeBoarding/Collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```mermaid
graph LR
Collection["Collection"]
AsyncCollection["AsyncCollection"]
AsyncCollection -- "inherits from" --> Collection
```
[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])

## Component Details

The Collection component in PyMongo provides an interface for interacting with MongoDB collections, offering methods for CRUD operations, index management, and other collection-level functionalities. It has both synchronous (Collection) and asynchronous (AsyncCollection) implementations, catering to different application needs. The core functionality revolves around executing commands against the MongoDB server and handling the responses.

### Collection
The Collection class provides synchronous operations for interacting with a MongoDB collection. It includes methods for inserting, updating, deleting, finding, and aggregating documents, as well as managing indexes.
- **Related Classes/Methods**: `pymongo.synchronous.collection.Collection` (137:3610), `pymongo.synchronous.collection.Collection:__init__` (140:268), `pymongo.synchronous.collection.Collection:insert_one` (839:901), `pymongo.synchronous.collection.Collection:find_one` (1724:1757), `pymongo.synchronous.collection.Collection:update_one` (1234:1352), `pymongo.synchronous.collection.Collection:delete_one` (1594:1657)

### AsyncCollection
The AsyncCollection class provides asynchronous operations for interacting with a MongoDB collection. It includes methods for inserting, updating, deleting, finding, and aggregating documents, as well as managing indexes. It inherits from Collection and overrides methods to provide asynchronous functionality.
- **Related Classes/Methods**: `pymongo.asynchronous.collection.AsyncCollection` (138:3617), `pymongo.asynchronous.collection.AsyncCollection:__init__` (141:267), `pymongo.asynchronous.collection.AsyncCollection:insert_one` (840:902), `pymongo.asynchronous.collection.AsyncCollection:find_one` (1725:1758), `pymongo.asynchronous.collection.AsyncCollection:update_one` (1235:1353), `pymongo.asynchronous.collection.AsyncCollection:delete_one` (1595:1658)
Loading