MCPcopy Index your code
hub / github.com/CloudBoost/cloudboost / findOne

Method findOne

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

Source from the content-addressed store, hash-verified

978 }
979 };
980 findOne(callback) { //find a single document matching the given query
981 if (!CB.appId) {
982 throw "CB.appId is null.";
983 }
984 if (!this.tableName) {
985 throw "TableName is null.";
986 }
987 var def;
988 if (!callback) {
989 def = new CB.Promise();
990 }
991 var params = JSON.stringify({query: this.query, select: this.select, sort: this.sort, skip: this.skip, key: CB.appKey});
992 var url = CB.apiUrl + "/data/" + CB.appId + "/" + this.tableName + '/findOne';
993
994 CB._request('POST', url, params).then(function(response) {
995 var object = CB.fromJSON(JSON.parse(response));
996 if (callback) {
997 callback.success(object);
998 } else {
999 def.resolve(object);
1000 }
1001 }, function(err) {
1002 if (callback) {
1003 callback.error(err);
1004 } else {
1005 def.reject(err);
1006 }
1007 });
1008
1009 if (!callback) {
1010 return def.promise;
1011 }
1012 };
1013}
1014
1015// Logical operations

Callers 15

test.jsFile · 0.80
test.jsFile · 0.80
queryTest.jsFile · 0.80
getSchemaFunction · 0.80
loginFunction · 0.80
changePasswordFunction · 0.80
resetPasswordFunction · 0.80
resetUserPasswordFunction · 0.80
signupFunction · 0.80
verifyActivateCodeFunction · 0.80
upsertUserWithProviderFunction · 0.80
findOneFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected