Reputation: 1200
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
I am using jsstore 1.3.0
I updated jsstore version to 1.4.1 which is giving "Maximum call stack size exceeded"
Thanks
Upvotes: 9
Views: 11915
Reputation: 1840
For anyone else who is having this same issue and is actually passing a valid key, it could actually be that you are running.
objectStore.put(key, value)
when you should run
objectStore.put(value, key)
It's in reverse by the specs.
Upvotes: 1
Reputation: 2376
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.
Check out w3c for more info - https://w3c.github.io/IndexedDB/#key-construct
Upvotes: 16