SchemaFilter (Configuration Option)
- Last Updated: March 2, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.0
- Documentation
Purpose
Specifies a comma-separated list of database and collection pairs for which you want the driver to fetch metadata. SchemaFilter can significantly improve connection times by limiting the collections for which metadata is fetched to only those that are required by your application. If you do not specify a value, the driver fetches metadata for all the collections in every database that your account has access to, which can adversely impact performance during the initial connection to a database.
Valid Values
database_name:collection_name[[,database_name:collection_name]...]
where:
database_name- is a literal value or regular expression for the database that contains collections for which the driver fetches metadata.
collection_name- is a literal value or regular expression of the collection for which the driver fetches metadata.
- A literal name that does not contain either a comma ( , ) or a colon ( : )
- A literal name that contains a comma ( , ) or a colon ( : ) that is
bounded by a slash ( / ) at the beginning and end. For example, a collection named
sales:2019would be represented by/sales:2019/ - A regular expression bounded by a slash ( / ) at the beginning and end,
such as
/sales.*\d/ - An asterisk ( * ), which represents all databases or collections within the corresponding schema(s).
Examples
- Literal values: The following example returns
metadata for only the
novemberandmarchcollections in theoem_salesdatabase.SchemaFilter=oem_sales:november,oem_sales:march - Wildcard values: If you want the driver to
fetch metadata for all the tables in a schema, replace the value for the table or schema
name with an * (wildcard) character. For
example, the following returns metadata for all the tables in the
oem_salesand for tables namedcustomersin all databases.SchemaFilter=oem_sales:*,*:customers - Partial wildcard values: You can also use the
asterisk to specify partial values for databases and collections. For example, the
following returns metadata for all tables in the that end with
regionthat are in schemas that begin withsales.SchemaFilter=/sales.*/:/.*region/ -
Regular expressions: The following returns metadata for tables named
taxin all databases that start withyearwhich end with a number.SchemaFilter=*/year.*\d/:tax