# Durable and reliable contextStorage - DB/mysql/mariadb based

**URL:** https://discourse.nodered.org/t/durable-and-reliable-contextstorage-db-mysql-mariadb-based/95085
**Category:** General
**Created:** [3 February 2025 12:31 UTC](https://discourse.nodered.org/t/durable-and-reliable-contextstorage-db-mysql-mariadb-based/95085 "2025-02-03T12:31:54Z")
**Posts on this page:** 1
**Showing post:** 56

<div class="post-metadata">

### Author: ![ziga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ziga/32/98138_2.png) [@ziga](https://discourse.nodered.org/u/ziga)
#### Post date: [10 February 2025 13:47 UTC](https://discourse.nodered.org/t/durable-and-reliable-contextstorage-db-mysql-mariadb-based/95085/56 "2025-02-10T13:47:36Z")

</div>

Make sure to use latest `1.0.5` version as per bug that was reported by @gregorius

> [@Custom context storage plugins](https://discourse.nodered.org/t/custom-context-storage-plugins/95249/2):
>
> Good work on creating a bunch of storage adapters, will make many folks happy. I was looking through the [codebase](https://github.com/sebenik/node-red-context/blob/master/packages/base/index.js) and I have a question about the set functionality. I assume that the BaseContext [set method](https://github.com/sebenik/node-red-context/blob/55659138d198a5bdf9a0c847479709a4c2a767ef/packages/base/index.js#L73) ... set(scope, key, value, callback) { return this.queue.enqueue(async () =\> { if (!key) { throw new Error('Key is not defined'); } if (!callback || typeof callback !== 'function') { throw new Error('Callback is not a function'); } if (!Array.isArray(key)) { key = [k…

and in 1.0.5 additional bug was fixed when retrieving keys that don't exist.

> [@jakonnode](#):
>
> All the context values are stored in one row - it is getting updated instead of inserting.

This is true for "nested" keys yes, e.g if you are storing a value to object a.b = 12, in database everything stored under object a gets stored as a value, so above becomes key: `a`, value: `{ "b": 12 }`

---

_[View the full topic](https://discourse.nodered.org/t/durable-and-reliable-contextstorage-db-mysql-mariadb-based/95085)._
