The MongoDBLoader component is used to upload a large number of records to MongoDB in bulk.
To start uploading data, create a MongoDBLoader component. Then you can adjust its BatchSize property, which determines the maximum number of records in a batch (1000 by default). After this, specify the columns to load data to. You can do it either manually, using the Columns property, or with the CreateColumns method, which retrieves column information from the table specified in the TableName property. Then call the Open method and use the SetValue method to set values for the row fields. To switch to the next row, call the NextRow method.
After you finish loading data, call the Close method. This method sends the last batch to the server.
The target collection must exist unless the Create Collection On Insert connection string parameter is set to True. If a loaded field doesn't exist in the collection, MongoDBLoader writes it when the Allow Add Fields connection string parameter is set to True (default).
The following example demonstrates how to use the MongoDBLoader class.