<@U04S8PLJWMT> I'm trying to create a sync from Mo...
# ask-ai
i
@kapa.ai I'm trying to create a sync from MongoDB to Bigquery and it's crashing when fetching the schema of my data as my mongo ddbb has many collections and the it times out when fetching the schema, what can i do to avoid this and complete the sync properly?
k
When syncing from MongoDB to BigQuery, schema discovery can time out if your MongoDB database has many collections or large collections. This is a common issue, and there are several recommended steps to address it: 1. Increase Airbyte's Timeout Limits Airbyte's schema discovery process may exceed the default timeout when dealing with many collections. You can increase the timeout by setting environment variables in your Airbyte server configuration:
Copy code
yaml    server:        extraEnvs:          - name: HTTP_IDLE_TIMEOUT            value: 20m          - name: READ_TIMEOUT            value: 30m
Adjust these values as needed for your environment. This change allows the schema discovery process more time to complete without timing out. [Scaling Airbyte: Schema Discovery Timeouts](https://docs.airbyte.com/platform/1.7/enterprise-setup/scaling-airbyte#schema-discovery-timeouts) 2. Limit User Access to Only Necessary Collections If possible, configure your MongoDB user to only have access to the collections you actually need to sync. This reduces the number of collections Airbyte needs to process, speeding up schema discovery and reducing the chance of timeouts. [Forum: Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665) 3. Divide Large Connections For very large databases, consider splitting your sync into multiple connections, each with a user that only has access to a subset of collections. This can help avoid timeouts and make the process more manageable. [Forum: Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665) 4. Check for Load Balancer or Proxy Timeouts If you are running Airbyte behind a load balancer or proxy (like nginx), ensure that its timeout settings are also increased to accommodate longer schema discovery operations. [Forum: Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665) By applying these changes, you should be able to avoid schema discovery timeouts and complete your MongoDB to BigQuery sync successfully. If you continue to experience issues, consider reviewing server and connector logs for additional bottlenecks or errors.
i
@kapa.ai Thanks, I've tried to use a user with access to Only Necessary Collections, but i can't run incremental ingestions with this user, it crashes as incremental ingestions can be only run when having the complete view of the DDBB
k
A message from kapa.ai
You're correct that for incremental syncs (using Change Data Capture/CDC) with the MongoDB V2 connector, Airbyte requires broader privileges. Specifically, starting from version 2.0.0, the connector supports monitoring multiple databases and collections, and the recommended setup is to grant the user the
readAnyDatabase
privilege. Without this, the connection may fail with authorization errors, especially for incremental syncs across multiple collections or databases. This is because CDC needs to monitor the oplog at the cluster level, not just for individual collections or databases. Here’s what the documentation says: > Starting in version v2.0.0, change data capture now supports monitoring the entire cluster, not just a single database. This allows you to sync multiple collections across different databases using a single source. The readAnyDatabase privilege is required for this expanded access. Without it, the connection will fail with an authorization error. > > [MongoDB V2 Quick Start](https://docs.airbyte.com/integrations/sources/mongodb-v2#quick-start) So, if you restrict the user to only a subset of collections or databases, incremental syncs may not work as expected. The connector needs a "complete view" of the database (or even the cluster) to properly track changes via the oplog. Summary: - Limiting user access to only some collections can help with schema discovery timeouts, but it will break incremental syncs with the MongoDB V2 connector. - For incremental syncs, you must use a user with the required cluster-level privileges (such as
readAnyDatabase
). If you need to limit the scope of data for your sync, consider using views or separate databases, but the user still needs the broader privileges for CDC to function properly.