0.1.0 • Published 5 years ago

gudsi-mongodb-plugin v0.1.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

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)

API reference for createIndex

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)

API reference for dropIndex

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)

API reference for aggregate

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)

API reference for count

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)

API reference for find

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)

API reference for findOne

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)

API reference for insertOne

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)

API reference for insertMany

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)

API reference for replaceOne

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)

API reference for updateOne

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)

API reference for updateMany

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)

API reference for deleteOne

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)

API reference for deleteMany

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.