Hey there! I am currently working on storing three fields in an IndexedDB. When I view them in the browser, I see the names of each index - content, content2, and content3. However, only data is being saved into content3. Can you help me figure out why?
Below is the source code I am using:
<script type="text/javascript">
var request = indexedDB.open("synker");
var db;
request.onupgradeneeded = function() {
// The database did not previously exist, so create object stores and indexes.
db = request.result;
var store = db.createObjectStore("notes", {keyPath: "ID"});
store.createIndex("content","content", { unique: false });
store.createIndex("content2","content2", { unique: false });
store.createIndex("content3","content3", { unique: false });
};
request.onsuccess = function() {
db = request.result;
};
function addData(data) {
var tx = db.transaction("notes", "readwrite");
var store = tx.objectStore("notes");
store.put({content: data, ID:1});
store.put({content2: data, ID:1});
store.put({content3: data, ID:1});
}