未捕获的 ydn.error.ArgumentException:需要在商店“contactRole”store.js 第 1284 行中找不到索引“Account__c,PrimaryContact
Posted
技术标签:
【中文标题】未捕获的 ydn.error.ArgumentException:需要在商店“contactRole”store.js 第 1284 行中找不到索引“Account__c,PrimaryContact__c”【英文标题】:Uncaught ydn.error.ArgumentException: require index "Account__c,PrimaryContact__c" not found in store "contactRole" store.js line 1284 【发布时间】:2015-07-23 05:39:05 【问题描述】:我有以下:
ydbStorage = new ydn.db.Storage(dbName, schema);
/**
@param values - An array of keys . e.g. ['account1', 'city1']
@param index - An string of index value . e.g. 'account, city'
@description - Get records based on compound index. Remember that indexes are not created for boolean values
*/
var getRecordsOnCompoundIndex = function(store_name, index, values, success_callback, failure_callback)
console.log('Inside getRecordsOnCompoundIndex');
if(!store_name || ! index || !values)
failure_callback();
else
var keyRange = ydn.db.KeyRange.only(values);
ydbStorage.values(new ydn.db.IndexValueIterator(store_name, index, keyRange)).done(function(response)
if(!response)
failure_callback();
else
success_callback(response);
);
$scope.getAccountKeyContact = function()
var indexes = 'Account__c,PrimaryContact__c';
var values = [accountId, "true"];
ydbDatabase.getRecordsOnCompoundIndex('contactRole', indexes, values, function(records)
//console.log('KeyContact role is : ', records);
ydbDatabase.getRecordOnId('contacts', records[0].Contact__c, function(record)
$scope.outlet.keyContact = record;
$scope.outlet.keyContact.designation = records[0].Role__c;
$scope.$apply();
, function()
console.log('Could not get KeyContact');
);
, function()
console.log('Could not get contactRole Role');
);
尽管存在复合索引,但我收到以下错误。
未捕获的 ydn.error.ArgumentException:需要在商店“contactRole”中找不到索引“Account__c,PrimaryContact__c”
不知道哪里出了问题。有什么建议。错误在于 ydbDatabase.getRecordsOnCompoundIndex
行【问题讨论】:
【参考方案1】:您确定复合索引为describe here。它应该是这样的:
var schema =
store: [
name: 'contactRole',
indexes: [
name: 'AccuntContact',
keyPath: ['Account__c', 'PrimaryContact__c']
]
]
;
【讨论】:
以上是关于未捕获的 ydn.error.ArgumentException:需要在商店“contactRole”store.js 第 1284 行中找不到索引“Account__c,PrimaryContact的主要内容,如果未能解决你的问题,请参考以下文章
如何在应用程序加载期间捕获“未捕获的类型错误:无法读取未定义的属性‘isModel’?
致命错误:未捕获的错误:未找到“Omnipay\Omnipay”类
未捕获的 ReferenceError:未定义 showCategory