Use the MongoDB source component to read data stored in an MongoDB collection.
Connection
Select an existing MongoDB connection or create a new one (for more information, see Allowing Xplenty access to MongoDB.)
Source Properties
- Source collection - the collection name from which the data will be imported.
- Filter query - use MongoDB extended JSON to apply a filter on MongoDB's server side, or leave empty to query the entire collection. Note that $ is a special character that denotes a variable, so it must be escaped by a single back-slash in your extended JSON filter. For example:
{"age":{"\$gt":24}}
- extract all documents where age is greater than 24.{"\$or":[{"price":{"\$exists":false}},{"price":{"\$eq":0}}]}
- extract all documents where price is zero or does not exist.{"timestamp":{"\$gt":{"\$date":"2014-01-01T00:00:00.000Z"}}}
- extract all documents where timestamp is greater than the date value 2014-01-01T00:00:00.000Z
Source Schema
After defining the source collection, select the fields to use in the source.
The fields you select are the only ones pulled from the source collection.
Define the data type for the field. Use the following table when matching MongoDB data types to Xplenty data types.
MongoDB | Xplenty |
String | String |
32 Bit Integer | Integer |
64 Bit Integer | Long |
Double | Double |
Date | DateTime |
Object | Json |
Array | Json Array |
Boolean | Boolean |
ObjectID | String |