我有以下内容:
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 行