Search code examples
dexie

Problem with saving record keys with dots to indexeddb (dexie.js)


I'm currently working with dexie.js and I found a problem. When I create a new record with keys that includes dots it will automaticaly convert them into tree structured object. {"showing.text.okey": "okey"} will be converted to {showing: {text: {okey: "okey"}}}. The strange part is that even if my code is the same, in some places it will work as inteded and in some places it will parse it as shown. I want to save it as it is. Is there a way to turn of automatic parse ? the strange part :)


Solution

  • Inserting objects with dotted keys using Table.add() or Table.put() will not treat the dotted keys specifically - they will be kept as they are and not create nested objects, but Table.update() allows fine-grained updates of individual properties, every key passed to Table.update() can be a dotted key. The same goes with Collection.modify().