java.lang.Object | |
↳ | org.mule.module.mongo.MongoCloudConnector |
![]() |
![]() |
MongoDB is an open source, high-performance, schema-free, document-oriented database that manages collections of BSON documents.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | BACKUP_THREADS | ||||||||||
String | CAPPED_DEFAULT_VALUE | ||||||||||
String | DEFAULT_OUTPUT_DIRECTORY | ||||||||||
String | WRITE_CONCERN_DEFAULT_VALUE |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
autoConnectRetry | This controls whether the system retries automatically on connection errors. | ||||||||||
client | |||||||||||
connectTimeout | The connection timeout in milliseconds; this is for establishing the socket connections (open). | ||||||||||
connectionsPerHost | The number of connections allowed per host (the pool size, per host) | ||||||||||
database | |||||||||||
host | The host of the Mongo server, it can also be a list of comma separated hosts for replicas | ||||||||||
logger | |||||||||||
maxWaitTime | The max wait time for a blocking thread for a connection from the pool in ms. | ||||||||||
mongo | |||||||||||
port | The port of the Mongo server | ||||||||||
socketTimeout | The socket timeout. | ||||||||||
threadsAllowedToBlockForConnectionMultiplier | Multiplier for connectionsPerHost for # of threads that can block |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a new user for this db
| |||||||||||
Convert a BasicBSONList into Json.
| |||||||||||
Method invoked when a
MongoSession needs to be created. | |||||||||||
Counts the number of objects that match the given query.
| |||||||||||
Counts the number of objects that match the given query.
| |||||||||||
Creates a new collection.
| |||||||||||
Creates a new GridFSFile in the database, saving the given content, filename, contentType,
and extraData, and answers it.
| |||||||||||
Creates a new index
| |||||||||||
Convert a DBObject into Map.
| |||||||||||
Convert DBObject to Json.
| |||||||||||
Method invoked when the
MongoSession is to be destroyed. | |||||||||||
Deletes a collection and all the objects it contains.
| |||||||||||
Drop the current database
| |||||||||||
Drops an existing index
| |||||||||||
Executes a dump of the database to the specified output directory.
| |||||||||||
Ends a consistent request.
| |||||||||||
Executes a command on the database
| |||||||||||
Answers if a collection exists given its name
| |||||||||||
Lists all the files that match the given query
| |||||||||||
Lists all the files that match the given query
| |||||||||||
Finds all objects that match a given query.
| |||||||||||
Finds all objects that match a given query.
| |||||||||||
Answers the first file that matches the given query.
| |||||||||||
Answers the first file that matches the given query.
| |||||||||||
Finds the first object that matches a given query.
| |||||||||||
Finds the first object that matches a given query.
| |||||||||||
Answers an inputstream to the contents of the first file that matches the given query.
| |||||||||||
Answers an inputstream to the contents of the first file that matches the given
queryAttributes.
| |||||||||||
Executes an incremental dump of the database
| |||||||||||
Inserts an object in a collection, setting its id if necessary.
| |||||||||||
Inserts an object in a collection, setting its id if necessary.
| |||||||||||
Convert JSON to DBObject.
| |||||||||||
Lists names of collections available at this database
| |||||||||||
Lists all the files that match the given query, sorting them by filename.
| |||||||||||
Lists all the files that match the given query, sorting them by filename.
| |||||||||||
List existent indices in a collection
| |||||||||||
Transforms a collection into a collection of aggregated groups, by applying a supplied
element-mapping function to each element, that transforms each one into a key-value pair,
grouping the resulting pairs by key, and finally reducing values in each group applying a
suppling 'reduce' function.
| |||||||||||
Convert a BasicBSONList into Json.
| |||||||||||
Removes all the files that match the given query.
| |||||||||||
Removes all the files that match the given query.
| |||||||||||
Removes all the objects that match the a given optional query.
| |||||||||||
Removes all the objects that match the a given optional query.
| |||||||||||
Takes the output from the dump and restores it.
| |||||||||||
Inserts or updates an object based on its object _id.
| |||||||||||
Inserts or updates an object based on its object _id.
| |||||||||||
Begins a consistent request, which allows you to be sure that each subsequent request to MongoDB happens in sequence.
| |||||||||||
Updates objects that matches the given query.
| |||||||||||
Update objects using a mongo function
| |||||||||||
Update objects using a mongo function
| |||||||||||
Updates objects that matches the given query.
| |||||||||||
Updates objects that matches the given query.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
This controls whether the system retries automatically on connection errors.
The connection timeout in milliseconds; this is for establishing the socket connections (open). 0 is default and infinite.
The number of connections allowed per host (the pool size, per host)
The host of the Mongo server, it can also be a list of comma separated hosts for replicas
The max wait time for a blocking thread for a connection from the pool in ms.
The port of the Mongo server
The socket timeout. 0 is default and infinite.
Multiplier for connectionsPerHost for # of threads that can block
Adds a new user for this db
newUsername | Name of the user |
---|---|
newPassword | Password that will be used for authentication |
Convert a BasicBSONList into Json.
input | The input for this transformer |
---|
Method invoked when a MongoSession
needs to be created.
username | The username to use for authentication. NOTE: Please use a dummy user if you have disabled Mongo authentication |
---|---|
password | The password to use for authentication. If the password is null or whitespaces only the connector won't use authentication. |
database | Name of the database |
MongoSession
ConnectionException |
---|
Counts the number of objects that match the given query. If no query is passed, returns the number of elements in the collection
collection | The target collection |
---|---|
query | The optional DBObject query for counting objects. Only objects matching it will be counted. If unspecified, all objects are counted. |
Counts the number of objects that match the given query. If no query is passed, returns the number of elements in the collection
collection | The target collection |
---|---|
queryAttributes | The optional query for counting objects. Only objects matching it will be counted. If unspecified, all objects are counted. |
Creates a new collection. If the collection already exists, a MongoException will be thrown.
collection | The name of the collection to create |
---|---|
capped | If the collection will be capped |
maxObjects | The maximum number of documents the new collection is able to contain |
size | The maximum size of the new collection |
Creates a new GridFSFile in the database, saving the given content, filename, contentType, and extraData, and answers it.
payload | The mandatory content of the new gridfs file. It may be a java.io.File, a byte[] or an InputStream. |
---|---|
filename | The mandatory name of new file. |
contentType | The optional content type of the new file |
metadata | The optional DBObject metadata of the new content type |
IOException | IOException |
---|
Creates a new index
collection | The name of the collection where the index will be created |
---|---|
field | The name of the field which will be indexed |
order | The indexing order |
Convert a DBObject into Map.
input | The input for this transformer |
---|
Convert DBObject to Json.
input | The input for this transformer |
---|
Method invoked when the MongoSession
is to be destroyed.
IOException | in case something goes wrong when disconnecting. |
---|
Deletes a collection and all the objects it contains. If the collection does not exist, does nothing.
collection | The name of the collection to drop |
---|
Drop the current database
Drops an existing index
collection | The name of the collection where the index is |
---|---|
index | The name of the index to drop |
Executes a dump of the database to the specified output directory. If no output directory is provided then the default /dump directory is used.
outputDirectory | Output directory path, if no output directory is provided the default /dump directory is assumed |
---|---|
outputName | Output file name, if it's not specified the database name is used |
zip | Whether to zip the created dump file or not |
oplog | Point in time backup (requires an oplog) |
threads | Amount of threads to execute the dump |
IOException | if an error occurs during the dump |
---|
Ends a consistent request.
Executes a command on the database
commandName | The command to execute on the database |
---|---|
commandValue | The value for the command |
Answers if a collection exists given its name
collection | The name of the collection |
---|
Lists all the files that match the given query
query | A DBObject query the optional query |
---|
Lists all the files that match the given query
queryAttributes | The optional query attributes |
---|
Finds all objects that match a given query. If no query is specified, all objects of the collection are retrieved. If no fields object is specified, all fields are retrieved.
collection | The target collection |
---|---|
query | The optional DBObject query object. If unspecified, all documents are returned. |
fields | Alternative way of passing fields as a literal List |
numToSkip | Number of objects skip (offset) |
limit | Limit of objects to return |
sortBy | Indicates the DBObject used to sort the results |
Finds all objects that match a given query. If no query is specified, all objects of the collection are retrieved. If no fields object is specified, all fields are retrieved.
collection | The target collection |
---|---|
queryAttributes | The optional query object. If unspecified, all documents are returned. |
fields | Alternative way of passing fields as a literal List |
numToSkip | Number of objects skip (offset) |
limit | Limit of objects to return |
sortBy | Indicates the DBObject used to sort the results |
Answers the first file that matches the given query. If no object matches it, a MongoException is thrown.
query | The DBObject mandatory query |
---|
Answers the first file that matches the given query. If no object matches it, a MongoException is thrown.
queryAttributes | The mandatory query |
---|
Finds the first object that matches a given query. Throws a MongoException if no one matches the given query
collection | The target collection |
---|---|
query | The mandatory DBObject query object that the returned object matches. |
fields | Alternative way of passing fields as a literal List |
failOnNotFound | Flag to specify if an exception will be thrown when no object is found. For backward compatibility the default value is true. |
Finds the first object that matches a given query. Throws a MongoException if no one matches the given query
collection | The target collection |
---|---|
queryAttributes | The mandatory query object that the returned object matches. |
fields | Alternative way of passing fields as a literal List |
failOnNotFound | Flag to specify if an exception will be thrown when no object is found. For backward compatibility the default value is true. |
Answers an inputstream to the contents of the first file that matches the given query. If no object matches it, a MongoException is thrown.
query | The DBObject mandatory query |
---|
Answers an inputstream to the contents of the first file that matches the given queryAttributes. If no object matches it, a MongoException is thrown.
queryAttributes | The mandatory query attributes |
---|
Executes an incremental dump of the database
outputDirectory | Output directory path, if no output directory is provided the default /dump directory is assumed |
---|---|
incrementalTimestampFile | File that keeps track of the last timestamp processed, if no file is provided one is created on the output directory |
IOException | if an error occurs during the incremental dump |
---|
Inserts an object in a collection, setting its id if necessary.
collection | The name of the collection where to insert the given object |
---|---|
dbObject | A DBObject instance. |
writeConcern | The optional write concern of insertion |
Inserts an object in a collection, setting its id if necessary.
A shallow conversion into DBObject is performed - that is, no conversion is performed to its values.collection | The name of the collection where to insert the given object |
---|---|
elementAttributes | Alternative way of specifying the element as a literal Map inside a Mule Flow |
writeConcern | The optional write concern of insertion |
Convert JSON to DBObject.
input | The input for this transformer |
---|
Lists names of collections available at this database
Lists all the files that match the given query, sorting them by filename. If no query is specified, all files are listed.
query | The DBObject optional query |
---|
Lists all the files that match the given query, sorting them by filename. If no query is specified, all files are listed.
queryAttributes | The optional query |
---|
List existent indices in a collection
collection | The name of the collection |
---|
Transforms a collection into a collection of aggregated groups, by applying a supplied element-mapping function to each element, that transforms each one into a key-value pair, grouping the resulting pairs by key, and finally reducing values in each group applying a suppling 'reduce' function.
Each supplied function is coded in JavaScript. Note that the correct way of writing those functions may not be obvious; please consult MongoDB documentation for writing them.collection | The name of the collection to map and reduce |
---|---|
mapFunction | A JavaScript encoded mapping function |
reduceFunction | A JavaScript encoded reducing function |
outputCollection | The name of the output collection to write the results, replacing previous collection if existed, mandatory when results may be larger than 16MB. If outputCollection is unspecified, the computation is performed in-memory and not persisted. |
Convert a BasicBSONList into Json.
input | The input for this transformer |
---|
Removes all the files that match the given query. If no query is specified, all files are removed
query | The DBObject optional query |
---|
Removes all the files that match the given query. If no query is specified, all files are removed
queryAttributes | The optional query |
---|
Removes all the objects that match the a given optional query. If query is not specified, all objects are removed. However, please notice that this is normally less performant that dropping the collection and creating it and its indices again
collection | The collection whose elements will be removed |
---|---|
query | The optional DBObject query object. Objects that match it will be removed. |
writeConcern | The write concern used to remove the object |
Removes all the objects that match the a given optional query. If query is not specified, all objects are removed. However, please notice that this is normally less performant that dropping the collection and creating it and its indices again
collection | The collection whose elements will be removed |
---|---|
queryAttributes | The query object. Objects that match it will be removed. |
writeConcern | The write concern used to remove the object |
Takes the output from the dump and restores it. Indexes will be created on a restore. It only does inserts with the data to restore, if existing data is there, it will not be replaced.
inputPath | Input path to the dump files, it can be a directory, a zip file or just a bson file |
---|---|
drop | Whether to drop existing collections before restore |
oplogReplay | Replay oplog for point-in-time restore |
IOException | if an error occurs during restore of the database |
---|
Inserts or updates an object based on its object _id.
collection | The collection where to insert the object |
---|---|
element | The mandatory DBObject object to insert. |
writeConcern | The write concern used to persist the object |
Inserts or updates an object based on its object _id.
collection | The collection where to insert the object |
---|---|
elementAttributes | The mandatory object to insert. |
writeConcern | The write concern used to persist the object |
autoConnectRetry |
---|
connectTimeout |
---|
connectionsPerHost |
---|
database |
---|
host |
---|
maxWaitTime |
---|
port |
---|
socketTimeout |
---|
threadsAllowedToBlockForConnectionMultiplier |
---|
Begins a consistent request, which allows you to be sure that each subsequent request to MongoDB happens in sequence.
Updates objects that matches the given query. If parameter multi is set to false, only the first document matching it will be updated. Otherwise, all the documents matching it will be updated.
collection | The name of the collection to update |
---|---|
query | The DBObject query object used to detect the element to update. If the object Id is an instance of ObjectId you need to specify the value pair as map with the following structure: { "_id" : "ObjectId(OBJECT_ID_VALUE)"} |
element | The DBObject mandatory object that will replace that one which matches the query. |
upsert | If the database should create the element if it does not exist |
multi | If all or just the first object matching the query will be updated |
writeConcern | The write concern used to update |
Update objects using a mongo function
collection | The name of the collection to update |
---|---|
function | The function used to execute the update |
query | The DBObject query object used to detect the element to update. |
element | The DBObject mandatory object that will replace that one which matches the query. |
upsert | If the database should create the element if it does not exist |
multi | If all or just the first object matching the query will be updated |
writeConcern | The write concern used to update |
Update objects using a mongo function
collection | The name of the collection to update |
---|---|
function | The function used to execute the update |
queryAttributes | The query object used to detect the element to update. |
elementAttributes | The mandatory object that will replace that one which matches the query. |
upsert | If the database should create the element if it does not exist |
multi | If all or just the first object matching the query will be updated |
writeConcern | The write concern used to update |
Updates objects that matches the given query. If parameter multi is set to false, only the first document matching it will be updated. Otherwise, all the documents matching it will be updated.
collection | The name of the collection to update |
---|---|
queryAttributes | The query object used to detect the element to update. |
elementAttributes | The mandatory object that will replace that one which matches the query. |
upsert | If the database should create the element if it does not exist |
multi | If all or just the first object matching the query will be updated |
writeConcern | The write concern used to update |
Updates objects that matches the given query. If parameter multi is set to false, only the first document matching it will be updated. Otherwise, all the documents matching it will be updated.
collection | The name of the collection to update |
---|---|
queryAttributes | The query object used to detect the element to update. If the object Id is an instance of ObjectId you need to specify the value pair as map with the following structure: { "_id" : "ObjectId(OBJECT_ID_VALUE)"} |
element | The DBObject mandatory object that will replace that one which matches the query. |
upsert | If the database should create the element if it does not exist |
multi | If all or just the first object matching the query will be updated |
writeConcern | The write concern used to update |