MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / find

Method find

sdk/src/CloudQuery.js:830–873  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

828 };
829
830 find(callback) { //find the document(s) matching the given query
831 if (!CB.appId) {
832 throw "CB.appId is null.";
833 }
834 if (!this.tableName) {
835 throw "TableName is null.";
836 }
837 var def;
838 if (!callback) {
839 def = new CB.Promise();
840 }
841
842 var thisObj = this;
843
844 var params = JSON.stringify({
845 query: thisObj.query,
846 select: thisObj.select,
847 sort: thisObj.sort,
848 limit: thisObj.limit,
849 skip: thisObj.skip,
850 key: CB.appKey
851 });
852
853 var url = CB.apiUrl + "/data/" + CB.appId + "/" + thisObj.tableName + '/find';
854
855 CB._request('POST', url, params).then(function(response) {
856 var object = CB.fromJSON(JSON.parse(response));
857 if (callback) {
858 callback.success(object);
859 } else {
860 def.resolve(object);
861 }
862 }, function(err) {
863 if (callback) {
864 callback.error(err);
865 } else {
866 def.reject(err);
867 }
868 });
869
870 if (!callback) {
871 return def.promise;
872 }
873 };
874
875 findFromLocalStore(callback) {
876

Callers 15

deleteMethod · 0.95
paginateMethod · 0.95
getSettingsVariablesFunction · 0.80
initSettingsVariableFunction · 0.80
getMyUrlFunction · 0.80
changeUrlFunction · 0.80
cloudboost.jsFile · 0.80
removeFilesFunction · 0.80
expire.jsFile · 0.80
getSearchableDocumentsFunction · 0.80
listFunction · 0.80
test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected