new MongoClient()
A Vert.x service used to interact with MongoDB server instances.
- Source:
Methods
-
close()
-
Close the client and release its resources
- Source:
-
count(collection, query, resultHandler) → {MongoClient}
-
Count matching documents in a collection.
Parameters:
Name Type Description collectionstring the collection queryObject query used to match documents resultHandlerfunction will be provided with the number of matching documents - Source:
Returns:
- Type
- MongoClient
-
createCollection(collectionName, resultHandler) → {MongoClient}
-
Create a new collection
Parameters:
Name Type Description collectionNamestring the name of the collection resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
dropCollection(collection, resultHandler) → {MongoClient}
-
Drop a collection
Parameters:
Name Type Description collectionstring the collection resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
find(collection, query, resultHandler) → {MongoClient}
-
Find matching documents in the specified collection
Parameters:
Name Type Description collectionstring the collection queryObject query used to match documents resultHandlerfunction will be provided with list of documents - Source:
Returns:
- Type
- MongoClient
-
findOne(collection, query, fields, resultHandler) → {MongoClient}
-
Find a single matching document in the specified collection
Parameters:
Name Type Description collectionstring the collection queryObject the query used to match the document fieldsObject the fields resultHandlerfunction will be provided with the document, if any - Source:
Returns:
- Type
- MongoClient
-
findWithOptions(collection, query, options, resultHandler) → {MongoClient}
-
Find matching documents in the specified collection, specifying options
Parameters:
Name Type Description collectionstring the collection queryObject query used to match documents optionsObject options to configure the find resultHandlerfunction will be provided with list of documents - Source:
Returns:
- Type
- MongoClient
-
getCollections(resultHandler) → {MongoClient}
-
Get a list of all collections in the database.
Parameters:
Name Type Description resultHandlerfunction will be called with a list of collections. - Source:
Returns:
- Type
- MongoClient
-
insert(collection, document, resultHandler) → {MongoClient}
-
Insert a document in the specified collection
Parameters:
Name Type Description collectionstring the collection documentObject the document resultHandlerfunction result handler will be provided with the id if document didn't already have one - Source:
Returns:
- Type
- MongoClient
-
insertWithOptions(collection, document, writeOption, resultHandler) → {MongoClient}
-
Insert a document in the specified collection with the specified write option
Parameters:
Name Type Description collectionstring the collection documentObject the document writeOptionObject the write option to use resultHandlerfunction result handler will be provided with the id if document didn't already have one - Source:
Returns:
- Type
- MongoClient
-
remove(collection, query, resultHandler) → {MongoClient}
-
Remove matching documents from a collection
Parameters:
Name Type Description collectionstring the collection queryObject query used to match documents resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
removeOne(collection, query, resultHandler) → {MongoClient}
-
Remove a single matching document from a collection
Parameters:
Name Type Description collectionstring the collection queryObject query used to match document resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
removeOneWithOptions(collection, query, writeOption, resultHandler) → {MongoClient}
-
Remove a single matching document from a collection with the specified write option
Parameters:
Name Type Description collectionstring the collection queryObject query used to match document writeOptionObject the write option to use resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
removeWithOptions(collection, query, writeOption, resultHandler) → {MongoClient}
-
Remove matching documents from a collection with the specified write option
Parameters:
Name Type Description collectionstring the collection queryObject query used to match documents writeOptionObject the write option to use resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
replace(collection, query, replace, resultHandler) → {MongoClient}
-
Replace matching documents in the specified collection
Parameters:
Name Type Description collectionstring the collection queryObject query used to match the documents replaceObject all matching documents will be replaced with this resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
replaceWithOptions(collection, query, replace, options, resultHandler) → {MongoClient}
-
Replace matching documents in the specified collection, specifying options
Parameters:
Name Type Description collectionstring the collection queryObject query used to match the documents replaceObject all matching documents will be replaced with this optionsObject options to configure the replace resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
runCommand(commandName, command, resultHandler) → {MongoClient}
-
Run an arbitrary MongoDB command.
Parameters:
Name Type Description commandNamestring the name of the command commandObject the command resultHandlerfunction will be called with the result. - Source:
Returns:
- Type
- MongoClient
-
save(collection, document, resultHandler) → {MongoClient}
-
Save a document in the specified collection
Parameters:
Name Type Description collectionstring the collection documentObject the document resultHandlerfunction result handler will be provided with the id if document didn't already have one - Source:
Returns:
- Type
- MongoClient
-
saveWithOptions(collection, document, writeOption, resultHandler) → {MongoClient}
-
Save a document in the specified collection with the specified write option
Parameters:
Name Type Description collectionstring the collection documentObject the document writeOptionObject the write option to use resultHandlerfunction result handler will be provided with the id if document didn't already have one - Source:
Returns:
- Type
- MongoClient
-
update(collection, query, update, resultHandler) → {MongoClient}
-
Update matching documents in the specified collection
Parameters:
Name Type Description collectionstring the collection queryObject query used to match the documents updateObject used to describe how the documents will be updated resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient
-
updateWithOptions(collection, query, update, options, resultHandler) → {MongoClient}
-
Update matching documents in the specified collection, specifying options
Parameters:
Name Type Description collectionstring the collection queryObject query used to match the documents updateObject used to describe how the documents will be updated optionsObject options to configure the update resultHandlerfunction will be called when complete - Source:
Returns:
- Type
- MongoClient