gudsi-mongodb-plugin v0.1.0
gudsi-mongodb-plugin
This is a Cordova plugin that exposes the functionality of MongoDB Mobile to a Cordova Android app for local storage.
Install
To install this plugin run cordova plugin add gudsi-mongodb-plugin in your projects root folder.
Ionic integration
To use the plugin in ionic project run npm install ionic-native-mongodb in your projects root folder.
Ionic Native MongoDB
Functions
Below are the functions that are exposed in the plugin.
initiate(appId: string)
This function has to be called before doing anything else, this is a mongodb mobile requirement
appId the id of this app, this is more usefull when you are using stitch but mongo does it need the initialization.
dropDatabase(databaseName: string)
API reference for dropDatabase
databaseName the name of the database to delete.
createCollection(databaseName: string,collectionName: string,schema?: JSONObject)
API reference for createCollection
databaseName the name of the database.
collectionName the name of the new collection.
schema the schema with JSON Schema validation $jsonSchema.
dropCollection(databaseName: string,collectionName: string)
API reference for dropCollection
databaseName the name of the database that contains the database to delete.
collectionName the name of the collection to delete.
listCollectionNames(databaseName: string)
API reference for getCollectionNames
databaseName the name of the database to explore.
createIndex(databaseName: string, collectionName: string, keys: JSONObject, indexOptions: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
keys a document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field.
indexOptions a document that contains a set of options that controls the creation of the index.
dropIndex(databaseName: string, collectionName: string, indexName: string)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
indexName Specifies the name of the index to drop.
aggregate(databaseName: string, collectionName: string, pipeline: JSONArray)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
pipeline A sequence of data aggregation operations or stages.
API reference for aggregation pipeline stages
count(databaseName: string, collectionName: string, query?: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the query selection criteria.
find(databaseName: string, collectionName: string, query?: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query (optional) Specifies selection filter using query operators. To return all documents in a collection, omit this parameter or pass an empty document
findOne(databaseName: string, collectionName: string, query?: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query (optional) Specifies query selection criteria using query operators.
findById(databaseName: string, collectionName: string, id: string | {$oid:string})
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
id the id of the element to find.
findOneAndUpdate(databaseName: string, collectionName: string, query: JSONObject,update: JSONObject)
API reference for findOneAndUpdate
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the update. The same query selectors as in the find() method are available.
update the update document.
findOneAndReplace(databaseName: string, collectionName: string, query: JSONObject,replacement: JSONObject)
API reference for findOneAndReplace
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the update. The same query selectors as in the find() method are available.
replacement the replacement document.
findOneAndDelete(databaseName: string, collectionName: string, query: JSONObject)
API reference for findOneAndDelete
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the delete. The same query selectors as in the find() method are available.
insertOne(databaseName: string, collectionName: string, document: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
document a document to insert into the collection.
insertMany(databaseName: string, collectionName: string, documents: JSONArray)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
documents an array of documents to insert into the collection.
replaceOne(databaseName: string, collectionName: string, query: JSONObject , replacement: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the update. The same query selectors as in the find() method are available.
replacement the replacement document.
updateOne(databaseName: string, collectionName: string, query: JSONObject , update: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the update. The same query selectors as in the find() method are available.
update the modifications to apply.
updateMany(databaseName: string, collectionName: string, query: JSONObject , update: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query the selection criteria for the update. The same query selectors as in the find() method are available.
update the modifications to apply.
deleteOne(databaseName: string, collectionName: string, query: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query specifies deletion criteria using query operators.
deleteMany(databaseName: string, collectionName: string, query: JSONObject)
databaseName the name of the database that is to be used.
collectionName the name of the collection that is to be used.
query specifies deletion criteria using query operators.