问题描述
我正在使用jsstore的where类从indexeddb获取数据,但是得到了响应.无法对'IDBKeyRange'执行'only':参数不是有效的密钥."控制台错误.为什么会出现此错误.有人可以帮助我.
I am fetching data from indexeddb using where class using jsstore.I got response.But getting "Failed to execute 'only' on 'IDBKeyRange': The parameter is not a valid key. " console error.Why I am getting this error.can anyone pls help me.
//Get DBSchema(table & columns)
private getDbSchema = function () {
const tblArticle = {
Name: this._indexedDBLiveDBTableName,
Columns: [
{
Name: 'ParentName',
NotNull: true,
DataType: 'string'
},
{
Name: 'ChildName',
NotNull: true,
DataType: 'string'
}
,
{
Name: 'UpdatedDate',
NotNull: true,
DataType: 'string'
}
]
};
const Database = {
Name: this._indexedDBLiveDBName,
Tables: [tblArticle]
};
return Database as any;
};
//Fetch articles From IndexedDB
GetArticleFromIndexedDb(section) {
this._connection.openDb(this._indexedDBLiveDBName);
return this._connection.select({
From: this._indexedDBLiveDBTableName,
Where: {
ChildName: section
}
});
}
该部分的值将类似于印度",泰米尔纳德邦"
value of section will be like "India","TamilNadu"
请找到所附的屏幕截图以获取错误
Kindly find the attached screenshot for error
我正在使用 jsstore 1.3.0
我将jsstore版本更新为1.4.1,该版本给出了超出了最大调用堆栈大小"
I updated jsstore version to 1.4.1 which is giving "Maximum call stack size exceeded"
谢谢
推荐答案
这是由于提供的无效值所致. IndexedDB支持值列表-数字,日期,字符串,二进制数据,数组:它们是有效的键.
It is due to the invalid value supplied. IndexedDB support list of value - numbers, dates, strings, binary data, array : which are valid keys.
传递时通常会引发此错误-布尔值,空值或未定义的值.
This error is generally thrown when you are passing - boolean,null or undefined value.
查看w3c了解更多信息- https://w3c.github.io/IndexedDB /#key-construct
Check out w3c for more info - https://w3c.github.io/IndexedDB/#key-construct
这篇关于无法在"IDBKeyRange"上执行“仅":参数不是有效的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!