Storage service provides an efficient way to manage JSON documents in NoSQL database on the cloud. You can store, update, search a JSON document and can also apply map-reduce search on stored documents. For example if you try to store a JSON document “{"Company":"Shephertz"}”, it will be stored with unique Object Id in the format: {“Company”:”Shephertz”,”_id”:{“$oid”:”4f423dcce1603b3f0bd560cf”}}. This oid can be used later to access/search the document.
In order to use various functions available in a specific API, a developer has to create an instance of ServiceAPI by passing the apiKey and secretKey which will be created after the app creation from AppHQ dashboard.
Required Parameters
apiKey _ The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"<API_KEY>"; api.secretKey = @"<SECRET_KEY>";ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");$api = new ServiceAPI("API_KEY","SECRET_KEY");StorageService::Initialize("API_KEY","SECRET_KEY");Coming Soonvar api:ServiceAPI = new ServiceAPI("API_KEY","SECRET_KEY");Coming Soon
After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of StorageService, buildStorageService() method needs to be called.
StorageService storageService = api.buildStorageService();StorageService storageService = api.BuildStorageService();StorageService *storageService = [api buildStorageService];StorageService storageService = api.buildStorageService();StorageService storageService = api.buildStorageService();StorageService storageService = api.BuildStorageService();var storageService = new App42Storage();StorageService storageService = api.BuildStorageService();$storageService = $api->buildStorageService();StorageService* storageService = StorageService::getInstance();Coming Soonvar storageService:StorageService = api.buildStorageService();Coming Soon
import com.shephertz.app42.paas.sdk.android.ServiceAPI; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.storage.OrderByType; import com.shephertz.app42.paas.sdk.android.storage.Query; import com.shephertz.app42.paas.sdk.android.storage.QueryBuilder; import com.shephertz.app42.paas.sdk.android.storage.Storage; import com.shephertz.app42.paas.sdk.android.storage.StorageService; import com.shephertz.app42.paas.sdk.android.storage.QueryBuilder.Operator;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.storage;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"import com.shephertz.app42.paas.sdk.jme.ServiceAPI; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.storage.OrderByType; import com.shephertz.app42.paas.sdk.jme.storage.Query; import com.shephertz.app42.paas.sdk.jme.storage.QueryBuilder; import com.shephertz.app42.paas.sdk.jme.storage.Storage; import com.shephertz.app42.paas.sdk.jme.storage.StorageService; import com.shephertz.app42.paas.sdk.jme.storage.QueryBuilder.Operator;import com.shephertz.app42.paas.sdk.java.ServiceAPI; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.storage.OrderByType; import com.shephertz.app42.paas.sdk.java.storage.Query; import com.shephertz.app42.paas.sdk.java.storage.QueryBuilder; import com.shephertz.app42.paas.sdk.java.storage.Storage; import com.shephertz.app42.paas.sdk.java.storage.StorageService; import com.shephertz.app42.paas.sdk.java.storage.QueryBuilder.Operator;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.storage;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.storage;use com\shephertz\app42\paas\sdk\php\ServiceAPI; use com\shephertz\app42\paas\sdk\php\App42Response; use com\shephertz\app42\paas\sdk\php\App42Exception; use com\shephertz\app42\paas\sdk\php\App42BadParameterException; use com\shephertz\app42\paas\sdk\php\App42NotFoundException; use com\shephertz\app42\paas\sdk\php\storage\OrderByType; use com\shephertz\app42\paas\sdk\php\storage\Query; use com\shephertz\app42\paas\sdk\php\storage\QueryBuilder; use com\shephertz\app42\paas\sdk\php\storage\Storage; use com\shephertz\app42\paas\sdk\php\storage\StorageService; include_once '../ServiceAPI.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../OrderByType.php'; include_once '../Query.php'; include_once '../QueryBuilder.php'; include_once '../Storage.php'; include_once '../StorageService.php';#include "Storage/StorageService.h" #include "Storage/App42StorageResult.h"Coming Soonimport com.shephertz.app42.paas.sdk.as3.ServiceAPI; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.storage.Storage; import com.shephertz.app42.paas.sdk.as3.storage.StorageService;Coming Soon
Save the JSON document in given database name and collection name.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc has to be saved.
json - Target JSON document to be saved.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("collection Name is " + storage.getCollectionName()); ArrayList<Storage.JSONDocument>jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; storageService.InsertJSONDocument(dbName,collectionName,json, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *json = @"{\"Company\":\"Shephertz\"}"; Storage *storage = [storageService insertJSONDocument:dbName collectionName:collectionName json:json]; NSLog(@"dbName is %@" , storage.dbName); NSLog(@"collectionNameId is %@" , storage.collectionName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("collection Name is " + storage.getCollectionName()); ArrayList<Storage.JSONDocument>jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; storageService.InsertJSONDocument(dbName, collectionName, json, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", json = "{\"Company\":\"Shephertz\"}"; var response ; storageService.insertJSONDocument(dbName, collectionName, json,{ success: function(object) { var storageObj = JSON.parse(object); result = storageObj.app42.response.storage; console.log("dbName is " + result.dbName) console.log("objectId is " + result.jsonDoc._id.$oid) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String json = "{\"Company\":\"Shephertz\"}"; Storage storage = storageService.InsertJSONDocument(dbName,collectionName,json); Console.WriteLine("dbName is " + storage.GetDbName()); Console.WriteLine("collectionName is " + storage.GetCollectionName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $json = "{\"Company\":\"Shephertz\"}"; $storage = $storageService->insertJSONDocument($dbName, $collectionName, $json); print_r("dbName is " . $storage->getDbName()); print_r("collectionName is " . $storage->getCollectionName()); $jsonResponse = $storage->toString();class CApp42Callback : public IApp42Callback { public: void onResult(App42Result* result){ IwDebugTraceLinePrintf("StoragesResult::body is %s", result->getBody().c_str()); } }; CApp42Callback* authStorageCallback = NULL; std::string dbName = "<Enter_dataBase_name>"; std::string collectionName = "<Enter_the_collection_name>"; std::string json = "{\"Company\":\"Shephertz\"}"; storageService->InsertJSONDocument(dbName,collectionName,json,authStorageCallback); StorageService::Terminate(); if(authStorageCallback) { delete authStorageCallback; authStorageCallback = NULL; }Coming SoonNot AvailableComing Soon
Save the JSON document in given database name and collection name.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc has to be saved.
json - Target JSON document to be saved.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JSONObject json = new JSONObject(); json.put("Company","Shephertz"); Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName()); ArrayList<Storage.JSONDocument>jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JObject json = new JObject(); json.Add("Company","Shephertz"); storageService.InsertJSONDocument(dbName,collectionName,json, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *json = @"{\"Company\":\"Shephertz\"}"; Storage *storage = [storageService insertJSONDocument:dbName collectionName:collectionName json:json]; NSLog(@"dbName is %@" , storage.dbName); NSLog(@"collectionNameId is %@" , storage.collectionName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JSONObject json = new JSONObject(); json.put("Company","Shephertz"); Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JSONObject json = new JSONObject(); json.put("Company","Shephertz"); Storage storage = storageService.insertJSONDocument(dbName,collectionName,json); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName()); ArrayList<Storage.JSONDocument>jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JObject json = new JObject(); json.Add("Company","Shephertz"); storageService.InsertJSONDocument(dbName, collectionName, json, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; JObject json = new JObject(); json.Add("Company","Shephertz"); Storage storage = storageService.InsertJSONDocument(dbName,collectionName,json); Console.WriteLine("dbName is " + storage.GetDbName()); Console.WriteLine("collectionName is " + storage.GetCollectionName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $json = new JSONObject(); $json.put("Company","Shephertz"); $storage = $storageService->insertJSONDocument($dbName, $collectionName, $json); print_r("dbName is " . $storage->getDbName()); print_r("collectionName is " . $storage->getCollectionName()); $jsonResponse = $storage->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var jsonObj:Object = new Object(); jsonObj.key = "<Enter_the_value>"; storageService.insertJSONDocument(dbName,collectionName,jsonObj, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); } } }Coming Soon
Find all collections stored in given database.
Required Parameters
dbName - Unique handler for storage name.
String dbName = "<Enter_dataBase_name>"; Storage storage = storageService.findAllCollections(dbName); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName());public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; storageService.FindAllCollections(dbName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; Console.WriteLine("dbName is " + storage.GetDbName()); Console.WriteLine("collectionName is " + storage.GetCollectionName()); } }Coming SoonString dbName = "<Enter_dataBase_name>"; Storage storage = storageService.findAllCollections(dbName); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName());String dbName = "<Enter_dataBase_name>"; Storage storage = storageService.findAllCollections(dbName); System.out.println("dbName is " + storage.getDbName()); System.out.println("Collection Name is " + storage.getCollectionName());String dbName = "<Enter_dataBase_name>"; storageService.FindAllCollections(dbName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; App42Log.Console("dbName is " + storage.GetDbName()); App42Log.Console("collectionName is " + storage.GetCollectionName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", response ; storageService.findAllCollections(dbName,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is : " + response.dbName) console.log("collectionName is : " + response.collectionName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; Storage storage = storageService.FindAllCollections(dbName); Console.WriteLine("dbName is " + storage.GetDbName()); Console.WriteLine("collectionName is " + storage.GetCollectionName());$dbName = "<Enter_dataBase_name>"; $storage = $storageService->findAllCollections($dbName); print_r("dbName is " . $storage->getDbName()); print_r("collectionName is " . $storage->getCollectionName());class CApp42Callback : public IApp42Callback { public: void onResult(App42Result* result){ IwDebugTraceLinePrintf("StoragesResult::body is %s", result->getBody().c_str()); } }; CApp42Callback* authStorageCallback = NULL; std::string dbName = "<Enter_dataBase_name>"; storageService->FindAllCollections(dbName,authStorageCallback); StorageService::Terminate(); if(authStorageCallback) { delete authStorageCallback; authStorageCallback = NULL; }Coming Soonvar dbName:String = "<Enter_dataBase_name>"; storageService.findAllCollections(dbName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is " + storage.getDbName()); trace("collectionName is " + storage.getCollectionName()); } }Coming Soon
Find all documents stored in given database and collection.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc has to be saved.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Storage storage = storageService.findAllDocuments(dbName,collectionName); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; storageService.FindAllDocuments(dbName,collectionName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; Storage *storage = [storageService findAllDocuments:dbName collectionName:collectionName]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Storage storage = storageService.findAllDocuments(dbName,collectionName); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Storage storage = storageService.findAllDocuments(dbName,collectionName); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; storageService.FindAllDocuments(dbName,collectionName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", response ; storageService.findAllDocuments(dbName,collectionName,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Storage storage = storageService.FindAllDocuments(dbName,collectionName); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $storage = $storageService->findAllDocuments($dbName,$collectionName); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();class CApp42Callback : public IApp42Callback { public: void onResult(App42Result* result){ IwDebugTraceLinePrintf("StoragesResult::body is %s", result->getBody().c_str()); } }; CApp42Callback* authStorageCallback = NULL; std::string dbName = "<Enter_dataBase_name>"; std::string collectionName = "<Enter_the_collection_name>"; storageService->FindAllDocuments(dbName,collectionName,authStorageCallback); StorageService::Terminate(); if(authStorageCallback) { delete authStorageCallback; authStorageCallback = NULL; }Coming Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; storageService.findAllDocuments(dbName,collectionName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Gets the count of all documents stored in given database and collection.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.findAllDocumentsCount(dbName,collectionName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; storageService.FindAllDocumentsCount(dbName,collectionName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *dbName = @"<Enter_the_dbName>"; NSString *collectionName = @"<Enter_the_collection_name>"; App42Response *response = [storageService findAllDocumentsCount:dbName collectionName:collectionName]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.findAllDocumentsCount(dbName,collectionName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.findAllDocumentsCount(dbName,collectionName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; storageService.FindAllDocumentsCount(dbName, collectionName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", response ; storageService.findAllDocumentsCount(dbName,collectionName,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response; console.log("totalRecords is " + response.totalRecords) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.FindAllDocumentsCount(dbName,collectionName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $response = $storageService->findAllDocumentsCount($dbName,$collectionName); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; storageService.findAllDocumentsCount(dbName,collectionName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("response is : " + storage); } }Coming Soon
Find all documents stored in given database and collection.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; int max = 1; int offset = 0 ; Storage storage = storageService.findAllDocuments(dbName,collectionName,max,offset); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; int max = 1; int offset = 0 ; storageService.FindAllDocuments(dbName,collectionName,max,offset, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; int max = 1; int offset = 0 ; Storage *storage = [storageService findAllDocuments:dbName collectionName:collectionName max:max offset:offset]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Integer max = new Integer(1); Integer offset = new Integer(0); Storage storage = storageService.findAllDocuments(dbName,collectionName,max,offset); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; int max = 1; int offset = 0 ; Storage storage = storageService.findAllDocuments(dbName,collectionName,max,offset); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; int max = 1; int offset = 0 ; storageService.FindAllDocuments(dbName, collectionName, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", max = 1, offset = 0, response ; storageService.findAllDocumentsByPaging(dbName,collectionName,max,offset,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; int max = 1; int offset = 0 ; Storage storage = storageService.FindAllDocuments(dbName,collectionName,max,offset); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $max = 1; $offset = 0 ; $storage = $storageService->findAllDocuments($dbName,$collectionName,$max,$offset); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; storageService.findAllDocumentsByPaging(dbName,collectionName, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Find target document by given unique object id.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
docId - Unique Object Id handler.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Storage storage = storageService.findDocumentById(dbName,collectionName,docId); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; storageService.FindDocumentById(dbName,collectionName,docId, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *docId = @"docId"; Storage *storage = [storageService findDocumentById:dbName collectionName:collectionName docId:docId]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Storage storage = storageService.findDocumentById(dbName,collectionName,docId); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Storage storage = storageService.findDocumentById(dbName,collectionName,docId); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; storageService.FindDocumentById(dbName,collectionName,docId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "docId", response ; storageService.findDocumentById(dbName,collectionName,docId,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Storage storage = storageService.FindDocumentById(dbName,collectionName,docId); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $docId = "docId"; $storage = $storageService->findDocumentById($dbName,$collectionName,$docId); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();class CApp42Callback : public IApp42Callback { public: void onResult(App42Result* result){ IwDebugTraceLinePrintf("StoragesResult::body is %s", result->getBody().c_str()); } }; CApp42Callback* authStorageCallback = NULL; std::string dbName = "<Enter_dataBase_name>"; std::string collectionName = "<Enter_the_collection_name>"; std::string docId = "docId"; storageService->FindDocumentById(dbName,collectionName,docId,authStorageCallback); StorageService::Terminate(); if(authStorageCallback) { delete authStorageCallback; authStorageCallback = NULL; }Coming Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var docId:String = "docId"; storageService.findDocumentById(dbName,collectionName,docId, new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Find all documents stored in given database and collection.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
key - Key to be searched for target JSON doc.
value - Value to be searched for target JSON doc.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; storageService.FindDocumentByKeyValue(dbName,collectionName,key,value, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *key = @"<Enter_the_key>"; NSString *value = @"<Enter_the_value>"; Storage *storage = [storageService findDocumentByKeyValue:dbName collectionName:collectionName key:key value:value]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; storageService.FindDocumentByKeyValue(dbName, collectionName, key, value, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", value = "value", response ; storageService.findDocumentByKeyValue(dbName,collectionName,key,value,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; Storage storage = storageService.FindDocumentByKeyValue(dbName,collectionName,key,value); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "collectionName $key = "<Enter_the_key>"; $value = "<Enter_the_value>"; $storage = $storageService->findDocumentByKeyValue($dbName,$collectionName,$key,$value); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();class CApp42Callback : public IApp42Callback { public: void onResult(App42Result* result){ IwDebugTraceLinePrintf("StoragesResult::body is %s", result->getBody().c_str()); } }; CApp42Callback* authStorageCallback = NULL; std::string dbName = "<Enter_dataBase_name>"; std::string collectionName = "<Enter_the_collection_name>"; std::string key = "<Enter_the_key>"; std::string value = "<Enter_the_value>"; storageService->FindDocumentByKeyValue(dbName,collectionName,key,value,authStorageCallback); StorageService::Terminate(); if(authStorageCallback) { delete authStorageCallback; authStorageCallback = NULL; }Coming Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var key:String = "<Enter_the_key>"; var value:String = "<Enter_the_value>"; storageService.findDocumentByKeyValue(dbName,collectionName,key,value,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Find target document using Custom Query.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
query - Query Object containing custom query for searching docs.
String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocumentsByQuery(dbName,collectionName,q3,this); //This will return JSONObject list, there might be single or multiple objects if more than one object found void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *key = @"<Enter_the_key>"; NSString *value = @"<Enter_the_value>"; NSString *key1 = @"<Enter_the_key>"; NSNumber *value1= [NSNumber numberWithInt:30]; Query *q1 = [QueryBuilder buildQueryWithKey:key value:value operator:APP42_OP_EQUALS]; // Build query q1 for key equal to key Query *q2 = [QueryBuilder buildQueryWithKey:key1 value:value1 operator:APP42_OP_GREATER_THAN]; // Build query q2 for value1 greater than 30 Query *q3 = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_AND]; // Apply AND between q1 and q2 Storage *storage = [storageService findDocumentsByQuery:q3 dbName:dbName collectionName:collectionName]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocumentsByQuery(dbName,collectionName,q3, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", key1 = "key1", value = "value", value1 = 30, response ; var queryBuilder = new QueryBuilder(); var q1= queryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for employeeName equal to Nick var q2 = queryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for age greater than 30 var q3 = queryBuilder.compoundOperator(q1,Operator.AND, q2); // Apply AND between q1 and q2 storageService.findDocumentsByQuery(dbName, collectionName, q3,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.FindDocumentsByQuery(dbName,collectionName,q3); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "test"; $collectionName = "foo"; $key = "<Enter_the_key>"; $key1 = "<Enter_the_key>"; $value = "<Enter_the_value>"; $value1 = 30; $queryBuilder = new QueryBuilder(); $q1 = $queryBuilder->build($key, $value, Operator::EQUALS); // Build query q1 for key equal to key $q2 = $queryBuilder->build($key1, $value, Operator::GREATER_THAN); // Build query q2 for value1 greater than 30 $q3 = $queryBuilder->compoundOperator($q1, Operator::ANDop, $q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. $storage = $storageService->findDocumentsByQuery($dbName,$collectionName,$q3); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing Soonvar dbName:String = "test"; var collectionName:String = "foo"; var q1:Query = QueryBuilder.build("employeeName", "Nick", Operator.EQUALS); var q2:Query = QueryBuilder.build("age", 30, Operator.GREATER_THAN); var q3:Query = QueryBuilder.compoundOperator(q1, Operator.AND, q2); storageService.findDocumentsByQuery(dbName, collectionName, q3,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Find target document using Custom Query with paging.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
query - Query Object containing custom query for searching docs.
max - max result parameter.
offset - offset result parameter.
String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3,max,offset); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocumentsByQuery(dbName,collectionName,q3,max,offset,this); //This will return JSONObject list, there might be single or multiple objects if more than one object found void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *key = @"<Enter_the_key>"; NSString *value = @"<Enter_the_value>"; NSString *key1 = @"<Enter_the_key>"; NSNumber *value1= [NSNumber numberWithInt:30]; int max = 1; int offset = 0; Query *q1 = [QueryBuilder buildQueryWithKey:key value:value operator:APP42_OP_EQUALS]; // Build query q1 for key equal to key Query *q2 = [QueryBuilder buildQueryWithKey:key1 value:value1 operator:APP42_OP_GREATER_THAN]; // Build query q2 for value1 greater than 30 Query *q3 = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_AND]; // Apply AND between q1 and q2 Storage *storage = [storageService findDocumentsByQuery:q3 dbName:dbName collectionName:collectionName max:max offset:offset]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Integer max = new Integer(1); Integer offset = new Integer(0); Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3,max,offset); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,q3,max,offset); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocumentsByQuery(dbName, collectionName, q3, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", key1 = "key1", value = "value", value1 = 30, max = 1, offset = 0, response ; var queryBuilder = new QueryBuilder(); var q1= queryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for employeeName equal to Nick var q2 = queryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for age greater than 30 var q3 = queryBuilder.compoundOperator(q1,Operator.AND, q2); // Apply AND between q1 and q2 storageService.findDocumentsByQuery(dbName, collectionName, q3,max,offset,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.FindDocumentsByQuery(dbName,collectionName,q3,max,offset); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "test"; $collectionName = "foo"; $key = "<Enter_the_key>"; $key1 = "<Enter_the_key>"; $value = "<Enter_the_value>"; $value1 = 30; $max = 1; $offset = 30; $queryBuilder = new QueryBuilder(); $q1 = $queryBuilder->build($key, $value, Operator::EQUALS); // Build query q1 for key equal to key $q2 = $queryBuilder->build($key1, $value, Operator::GREATER_THAN); // Build query q2 for value1 greater than 30 $q3 = $queryBuilder->compoundOperator($q1, Operator::ANDop, $q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. $storage = $storageService->findDocumentsByQuery($dbName,$collectionName,$q3,$max,$offset); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing SoonComing SoonComing Soon
Find target document using Custom Query with paging and orderby.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
query - Query Object containing custom query for searching docs.
max - max result parameter.
offset - offset result parameter.
key - Key to be searched for target JSON doc.
type - Sorts the document by its type either ASCENDING or DESCENDING.
String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName,q3,max,offset,key1,OrderByType.ASCENDING); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocsWithQueryPagingOrderBy(dbName,collectionName,q3,max,offset,key1,OrderByType.ASCENDING,this); //This will return JSONObject list, there might be single or multiple objects if more than one object found void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *key = @"<Enter_the_key>"; NSString *value = @"<Enter_the_value>"; NSString *key1 = @"<Enter_the_key>"; NSNumber *value1= [NSNumber numberWithInt:30]; int max = 1; int offset = 0; Query *q1 = [QueryBuilder buildQueryWithKey:key value:value operator:APP42_OP_EQUALS]; // Build query q1 for key equal to key Query *q2 = [QueryBuilder buildQueryWithKey:key1 value:value1 operator:APP42_OP_GREATER_THAN]; // Build query q2 for value1 greater than 30 Query *q3 = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_AND]; // Apply AND between q1 and q2 Storage *storage = [storageService findDocsWithQueryPagingOrderBy:q3 dbName:dbName collectionName:collectionName max:max offset:offset orderByKey:key1 orderByType:APP42_ORDER_ASCENDING]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; Integer max = new Integer(1); Integer offset = new Integer(0); Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2,key1,OrderByType.ASCENDING); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName,q3,max,offset); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.compoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName,q3,max,offset,key1,OrderByType.ASCENDING); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. storageService.FindDocsWithQueryPagingOrderBy(dbName, collectionName, q3, max, offset, key1, OrderByType.ASCENDING, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", key1 = "key1", value = "value", value1 = 30, max = 1, offset = 0, response ; var queryBuilder = new QueryBuilder(); var q1= queryBuilder.build(key, value, Operator.EQUALS); // Build query q1 for employeeName equal to Nick var q2 = queryBuilder.build(key1, value1, Operator.GREATER_THAN); // Build query q2 for age greater than 30 var q3 = queryBuilder.compoundOperator(q1,Operator.AND, q2); // Apply AND between q1 and q2 storageService.findDocsWithQueryPagingOrderBy(dbName, collectionName, q3,max,offset,key1,OrderByType.ASCENDING,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String key1 = "<Enter_the_key>"; Object value = "<Enter_the_value>"; Object value1 = 30; int max = 1; int offset = 0; Query q1 = QueryBuilder.Build(key, value, Operator.EQUALS); // Build query q1 for key equal to key Query q2 = QueryBuilder.Build(key1, value1, Operator.GREATER_THAN); // Build query q2 for value1 greater than 30 Query q3 = QueryBuilder.CompoundOperator(q1, Operator.AND, q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. Storage storage = storageService.FindDocsWithQueryPagingOrderBy(dbName,collectionName,q3,max,offset,key1,OrderByType.ASCENDING); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "test"; $collectionName = "foo"; $key = "<Enter_the_key>"; $key1 = "<Enter_the_key>"; $value = "<Enter_the_value>"; $value1 = 30; $max = 1; $offset = 30; $queryBuilder = new QueryBuilder(); $q1 = $queryBuilder->build($key, $value, Operator::EQUALS); // Build query q1 for key equal to key $q2 = $queryBuilder->build($key1, $value, Operator::GREATER_THAN); // Build query q2 for value1 greater than 30 $q3 = $queryBuilder->compoundOperator($q1, Operator::ANDop, $q2); // Apply AND between q1 and q2 // Pass aggregated query q3 to finder method below. Similarly you can aggregate more conditions in querying object. $storage = $storageService->findDocsWithQueryPagingOrderBy($dbName,$collectionName,$q3,$max,$offset,$key1,OrderByType::ASCENDING); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing SoonComing SoonComing Soon
Update target document using key value search parameter. This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with new value passed.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
key - Key to be searched for target JSON doc.
value - Value to be searched for target JSON doc.
newJsonDoc - New Json document to be added.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *key = @"<Enter_the_key>"; NSString *value = @"<Enter_the_value>"; NSString *newJsonDoc = @"{\"Company\":\"Shephertz Technologies\"}"; Storage *storage = [storageService updateDocumentByKeyValue:dbName collectionName:collectionName key:key value:value newJsonDoc:newJsonDoc]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", value = "value", newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}", response ; storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "collectionName $key = "<Enter_the_key>"; $value = "<Enter_the_value>"; $newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; $storage = $storageService->updateDocumentByKeyValue($dbName,$collectionName,$key,$value,$newJsonDoc); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var key:String = "<Enter_the_key>"; var value:String = "<Enter_the_value>"; var newJsonDoc:Object = new Object(); newJsonDoc.key = "<Enter_the_value>"; storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,newJsonDoc,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Update target document using the document id.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
docId - Id of the document to be searched for target JSON doc.
newJsonDoc - New Json document to be added.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; storageService.UpdateDocumentByDocId(dbName,collectionName,docId,newJsonDoc, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; String *docId = @"docId"; NSString *newJsonDoc = @"{\"Company\":\"Shephertz Technologies\"}"; Storage *storage = [storageService updateDocumentByDocId:dbName collectionName:collectionName docId:docId newJsonDoc:newJsonDoc]; NSLog(@"dbName is %@" , storage.dbName); NSMutableArray *jsonDocArray = storage.jsonDocArray; for(JSONDocument *jsonDoc in jsonDocList) { NSLog(@"objectId is = %@ " , jsonDoc.docId); NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonDoc); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; storageService.UpdateDocumentByDocId(dbName, collectionName, docId, newJsonDoc, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "docId", newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}", response ; storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonDoc,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; String newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; Storage storage = storageService.UpdateDocumentByDocId(dbName,collectionName,docId,newJsonDoc); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }$dbName = "<Enter_dataBase_name>"; $collectionName = "collectionName $docId = "docId"; $newJsonDoc = "{\"Company\":\"Shephertz Technologies\"}"; $storage = $storageService->updateDocumentByDocId($dbName,$collectionName,$docId,$newJsonDoc); print_r("dbName is " . $storage->getDbName()); $jsonResponse = $storage->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var docId:String = "docId"; var newJsonDoc:Object = new Object(); newJsonDoc.key = "<Enter_the_value>"; storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonDoc,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("dbName is : " + storage.getDbName()); trace("collectionName is : " + storage.getCollectionName()); var jsonDoc:JSONDocument = new JSONDocument(); for(var i:int = 0; i<storage.getJsonDocList().length;i++) { jsonDoc = JSONDocument(storage.getJsonDocList()[i]); trace("objectId is : " + jsonDoc.getDocId()); trace("jsonDoc is : " + jsonDoc.getJsonDoc()); } } }Coming Soon
Delete target document using Object Id from given db and collection. The Object Id will be searched in the JSON doc stored on the cloud and matching Doc will be deleted.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
docId - Unique Object Id handler.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; App42Response response = storageService.deleteDocumentById(dbName,collectionName,docId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; storageService.DeleteDocumentById(dbName,collectionName,docId, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *dbName = @"<Enter_the_dbName>"; NSString *collectionName = @"<Enter_the_collection_name>"; String *docId = @"docId"; App42Response *response = [storageService deleteDocumentById:dbName collectionName:collectionName docId:docId]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; App42Response response = storageService.deleteDocumentById(dbName,collectionName,docId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; App42Response response = storageService.deleteDocumentById(dbName,collectionName,docId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; storageService.DeleteDocumentById(dbName, collectionName, docId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "docId", response ; storageService.deleteDocumentById(dbName,collectionName,docId,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; App42Response response = storageService.DeleteDocumentById(dbName,collectionName,docId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $docId = "docId"; $response = $storageService->deleteDocumentById($dbName,$collectionName,$docId); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var docId:String = "docId"; storageService.deleteDocumentById(dbName,collectionName,docId,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("response is : " + storage); } }Coming Soon
Save the JSON document in given database name and collection name. It accepts the HashMap containing key-value and convert it into JSON. Converted JSON doc further saved on the cloud using given db name and collection name.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc has to be saved.
map - HashMap containing key-value pairs.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; HashMap<String, String> map = new HashMap< String, String >(); map.put("Company", "Shephertz"); Storage storage = storageService.insertJsonDocUsingMap(dbName,collectionName,map); System.out.println("dbName is " + storage.getDbName()); String jsonResponse = storage.toString();public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Dictionary<String, String> map = new Dictionary<String, String>(); map.Add("Company", "Shephertz"); storageService.InsertJsonDocUsingMap(dbName,collectionName,map,requestCallback); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { Storage storage = (Storage) response; String jsonResponse = storage.ToString(); } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"Shephertz" forKey:@"Company"]; Storage *storage = [storageService insertJsonDocUsingMap:dbName collectionName:collectionName map:dict]; NSLog(@"dbName is = %@",storage.dbName); NSLog(@"collectionName is = %@",storage.collectionName); NSString *jsonResponse = [storage toString];String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Hashtable map = new HashMapHashtable(); map.put("Company", "Shephertz"); Storage storage = storageService.insertJsonDocUsingMap(dbName,collectionName,map); System.out.println("dbName is " + storage.getDbName()); String jsonResponse = storage.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; HashMap< String, String > map = new HashMap< String, String >(); map.put("Company", "Shephertz"); Storage storage = storageService.insertJsonDocUsingMap(dbName,collectionName,map); System.out.println("dbName is " + storage.getDbName()); String jsonResponse = storage.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Dictionary< String, String > map = new Dictionary< String, String >(); map.Add("Company", "Shephertz"); storageService.InsertJsonDocUsingMap(dbName,collectionName,map, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; Dictionary< String, String > map = new Dictionary< String, String >(); map.Add("Company", "Shephertz"); Storage storage = storageService.InsertJsonDocUsingMap(dbName,collectionName,map); Console.WriteLine("dbName is " + storage.GetDbName()); Console.WriteLine("Collection Name is " + storage.GetCollectionName()); String jsonResponse = storage.ToString();$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $map = array("Company" => "Shephertz"); $storage = $storageService->insertJsonDocUsingMap($dbName, $collectionName,$map); print_r("dbName is " . $storage->getDbName()); print_r("Collection Name is " . $storage->getCollectionName()); $jsonResponse = $storage->toString();Coming SoonComing SoonComing SoonComing Soon
Map reduce function to search the target document. Please see detail information on map-reduce http://en.wikipedia.org/wiki/MapReduce .
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
mapFunction - Map function to be used to search the document.
reduceFunction - Reduce function to be used to search the document.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; String response = storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction);public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction,requestCallback); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { String storage = (String) response; Console.WriteLine(storage); } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *mapFunction = @"function map(){ emit(this.user,1);}"; NSString *reduceFunction = @"function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; NSString *response = [storageService mapReduce:dbName collectionName:collectionName mapFunction:mapFunction reduceFunction:reduceFunction]String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; String response = storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction);String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; String response = storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction);String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String mapFunction = "function map(){ emit(this.user,1);}"; String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; String response = storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction);$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $mapFunction = "function map(){ emit(this.user,1);}"; $reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"; $response = $storageService-> mapReduce($dbName, $collectionName, $mapFunction, $reduceFunction);Coming SoonComing SoonComing SoonComing Soon
Delete all documents from selected db.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.deleteAllDocuments(dbName,collectionName); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; storageService.DeleteAllDocuments(dbName, collectionName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.deleteAllDocuments(dbName,collectionName); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.deleteAllDocuments(dbName,collectionName); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; storageService.DeleteAllDocuments(dbName,collectionName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "<Enter_the_collection_name>"; storageService.deleteAllDocuments(dbName, collectionName,{ success: function(object) { var storageObj = JSON.parse(object); response = storageObj.app42.response.storage; console.log("dbName is " + response.dbName); }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; App42Response response = storageService.DeleteAllDocuments(dbName,collectionName); Boolean response = response.IsResponseSuccess(); String jsonResponse = response.ToString();Coming SoonComing SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; storageService.deleteAllDocuments(dbName,collectionName,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("response is : " + storage); } }Coming Soon
Find target document using Custom Query.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
Query - Query Object containing custom query for searching docs.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.setLat(new BigDecimal(29.685693)); gp.setLng(new BigDecimal(76.990482)); GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); Storage storage =storageService.findDocumentsByLocation(dbName, collectionName, query); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.SetLat(-73.99171); gp.SetLng(40.738868); GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); storageService.FindDocumentsByLocation(dbName, collectionName, query, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.setLat(new Double(-74.2713)); gp.setLng(new Double(40.73137)); GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); Storage storage =storageService.findDocumentsByLocation(dbName, collectionName, query); System.out.println("dbName is " + storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.setLat(new BigDecimal(29.685693)); gp.setLng(new BigDecimal(76.990482)); GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); Storage storage =storageService.findDocumentsByLocation(dbName, collectionName, query); System.out.println("dbName is " + storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.SetLat(-73.99171); gp.SetLng(40.738868); GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); storageService.FindDocumentsByLocation(dbName, collectionName, query, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; GeoTag gp = new GeoTag(); gp.SetLat(-73.99171); gp.SetLng(40.738868); GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100)); Storage storage =storageService.FindDocumentsByLocation(dbName, collectionName, query); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }Coming SoonComing SoonComing SoonComing SoonComing Soon
Delete target document using key and value from given db and collection. The key value will be searched in the JSON doc stored on the cloud and matching value will be deleted.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
key - Key to be searched for target JSON document which has to be deleted.
value - Value to be searched for target JSON document which has to be deleted.
String dbName = "<Enter_dataBase_name>"; String collectionName = "foo" String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; App42Response response = storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String dbName = "<Enter_the_dbName>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; storageService.DeleteDocumentsByKeyValue(dbName, collectionName, key, value, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; App42Response response = storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; App42Response response = storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value); boolean response = response.isResponseSuccess(); String jsonResponse = response.toString();String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; storageService.DeleteDocumentsByKeyValue(dbName,collectionName, key,value, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", key = "key", value = "<Enter_the_value>"; storageService.deleteDocumentsByKeyValue(dbName, collectionName,key,value,{ success: function(object) { var storage = JSON.parse(object); response = storage.app42.response; console.log("response is " + response) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String key = "<Enter_the_key>"; String value = "<Enter_the_value>"; App42Response response = storageService.DeleteDocumentsByKeyValue(dbName,collectionName, key,value); Boolean response = response.IsResponseSuccess(); String jsonResponse = response.ToString();Coming SoonComing SoonComing Soonvar dbName:String = "<Enter_dataBase_name>"; var collectionName:String = "<Enter_the_collection_name>"; var key:String = "<Enter_the_key>"; var value:String = "<Enter_the_value>"; storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value,new callback()); public class callback implements App42CallBack { public function onException(excption:App42Exception):void { trace("Exception Message"); } public function onSuccess(response:Object):void { var storage:Storage = Storage(response); trace("response is : " + storage); } }Coming Soon
This function allows you to revoke permission specified in the ACL list from a user on a given document id.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
docId - Unique Object Id handler.
aclList - object contains the username and the permission to be granted/ revoked. Default user name in aclList is set to PUBLIC. In this case, permission is granted/ revoked from all the users accessing the service..
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; IList<ACL> aclSet = new List<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Hashtable aclSet = new Hashtable(); aclSet.put("PUBLIC", ACL.PERMISSION_READ); Storage storage = storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); storageService.RevokeAccessOnDoc(dbName, collectionName, docId, aclSet, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "docId", response ; var aclList = new Array(); var point1={ user:"PUBLIC", permission:Permission.READ, }; storageService.revokeAccessOnDoc(dbName, collectionName,docId, aclList,{ success: function(object) { var storage = JSON.parse(object); response = storage.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.RevokeAccessOnDoc(dbName, collectionName, docId, aclSet); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }Coming SoonComing SoonComing SoonComing SoonComing Soon
This function allows you to grant permission specified in the ACL list to a user on a given document id.
Required Parameters
dbName - Unique handler for storage name.
collectionName - Name of collection under which JSON doc needs to be searched.
docId - Unique Object Id handler.
aclList - object contains the username and the permission to be granted/ revoked. Default user name in aclList is set to PUBLIC. In this case, permission is granted/ revoked from all the users accessing the service..
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }public class Callback : App42Callback String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; IList<ACL> aclSet = new List<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } }Coming SoonString dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; Hashtable aclSet = new Hashtable(); aclSet.put("PUBLIC", ACL.PERMISSION_READ); Storage storage = storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); Vector JsonDocList = storage.getJsonDocList(); for(int i=0;i < JsonDocList.size();i++) { Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i); System.out.println("objectId is " + jsonDoc.getDocId()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet); System.out.println("dbName is "+ storage.getDbName()); ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList(); for(Storage.JSONDocument jsonDoc : jsonDocList) { System.out.println("objectId is " + jsonDoc.getDocId()); JSONObject jsonObject = new JSONObject(jsonDoc.getJsonDoc()); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Storage storage = (Storage) response; IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { App42Log.Console("objectId is " + jsonDocList[i].GetDocId()); App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "docId", response ; var aclList = new Array(); var point1={ user:"PUBLIC", permission:Permission.READ, }; storageService.grantAccessOnDoc(dbName, collectionName,docId, aclList,{ success: function(object) { var storage = JSON.parse(object); response = storage.app42.response.storage; console.log("dbName is " + response.dbName) }, error: function(error) { } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "docId"; HashSet<ACL> aclSet = new HashSet<ACL>(); aclSet.Add(new ACL("PUBLIC", Permission.READ)); Storage storage = storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet); Console.WriteLine("dbName is " + storage.GetDbName()); IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); for(int i=0;i <jsonDocList.Count;i++) { Console.WriteLine("objectId is " + jsonDocList[i].GetDocId()); Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc()); }Coming SoonComing SoonComing SoonComing SoonComing Soon
The functions available under Storage API can throw some exceptions in abnormal conditions. Example of the same has been given below. E.g. If App developer is requesting for the document that does not exist, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “2600” and the details as “Document by the Id ‘4faa3f1ac68df147a51f8bd7’ does not exist”.
String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "4faa3f1ac68df147a51f8bd7"; try { Storage storage = storageService.findDocumentById(dbName, collectionName, docId); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147a5' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }public class Callback : App42Callback { String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "4faa3f1ac68df147a51f8bd7"; storageService.FindDocumentById(dbName,collectionName,docId, this); void App42Callback.OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147a7' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } void App42Callback.OnSuccess(Object response) { Storage storage = (Storage) response; String jsonResponse = storage.ToString(); } }NSString *dbName = @"<Enter_dataBase_name>"; NSString *collectionName = @"<Enter_the_collection_name>"; NSString *docId = @"4faa3f1ac68df147a51f8bd7"; @try { Storage *storage = [storageService findDocumentById:dbName collectionName:collectionName docId:docId]; } @catch(App42Exception exception) { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = exception.reason; }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "4faa3f1ac68df147a51f8bd7"; try { Storage storage = storageService.findDocumentById(dbName, collectionName, docId); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "4faa3f1ac68df147a51f8bd7"; try { Storage storage = storageService.findDocumentById(dbName, collectionName, docId); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }ComingSoonvar dbName = "<Enter_dataBase_name>", collectionName = "collectionName", docId = "4faa3f1ac68df147a51f8bd7"; var appErrorCode ; storageService.findDocumentById(dbName, collectionName, docId,{ success: function(object) { }, error: function(error) { var storageObj = JSON.parse(error); appErrorCode = storageObj.app42Fault.appErrorCode; if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });String dbName = "<Enter_dataBase_name>"; String collectionName = "<Enter_the_collection_name>"; String docId = "4faa3f1ac68df147a51f8bd7"; try { Storage storage = storageService.FindDocumentById(dbName, collectionName, docId); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if(appErrorCode == 2606) { // Handle here for Bad Request (Document Id '4faa3f1ac68df147a' is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); }$dbName = "<Enter_dataBase_name>"; $collectionName = "<Enter_the_collection_name>"; $docId = "4faa3f1ac68df147a51f8bd7"; try { $storage = $storageService->findDocumentById($dbName, $collectionName, $docId); } catch(App42Exception $exception) { $appErrorCode = $exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 2600) { // Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.) } else if($appErrorCode == 2606){ // Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }Coming SoonComing SoonComing SoonComing Soon
Functions in Storage API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid
1401 - UNAUTHORIZED - Client is not authorized
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again
2600 - NOT FOUND - Document by the Id '@docId' does not exist.
2601 - NOT FOUND - Document by key '@key' and value '@value' does not exist.
2602 - NOT FOUND - No document in the collection '@collectionName' exists.
2603 - BAD REQUEST - The request parameters are invalid. Make Sure DB and collection name exists and functions are syntactically correct.
2604 - NOT FOUND - No storage exist with the name '@storageName'.
2605 - BAD REQUEST - Passed JSON string '@newjsonDoc' is not valid.
2606 - BAD REQUEST - Document Id '@docId' is not valid.
2607 - NOT FOUND - The number of documents in the collection '@collectionName' are less than the specified offset
2606 - BAD REQUEST - Document Id '@docId' is not valid.