# Json-db-node-red keeping object that wasn't stored persistently

**URL:** <https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435>\
**Category:** General\
**Created:** [29 January 2022 02:12 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435 "2022-01-29T02:12:32Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [29 January 2022 19:00 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/21 "2022-01-29T19:00:58Z")

</div>

Yes - I cant delete topics.

```auto
// Deleting data
db.delete("/test1");

```

is not implemented in the Node.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [29 January 2022 19:13 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/22 "2022-01-29T19:13:00Z")

</div>

Here are some examples to directly construct the JsonDB object, but even if I do not use the module with path - I can't create the object.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e76c9ecdbe84022a07607d59a8001c6d2e1af126.png)

For me - it looks like I can't create any object with this library.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [29 January 2022 19:18 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/23 "2022-01-29T19:18:32Z")

</div>

It seems that I have a general problem to create objects with new. I tried it with another library and I got the same error.

Adding this parameter:

```auto
functionExternalModules: true

```

in settings.js makes no difference.

I guess I have a general problem.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [29 January 2022 20:30 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/24 "2022-01-29T20:30:36Z")

</div>

This seems to have gone rather off topic. For @knowledgeshark i think you would do best to look at the local context stores as previously mentioned as they are stores for json objects. Maybe not quite as flexible as a database but fine for simple set and get (and delete)

---

<div class="post-metadata">

**Author:** ![knowledgeshark](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knowledgeshark/32/4820_2.png) [@knowledgeshark](https://discourse.nodered.org/u/knowledgeshark)\
**Post date:** [29 January 2022 21:52 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/25 "2022-01-29T21:52:10Z")

</div>

> [@mickym2](#):
>
> `node-json-db`

Thanks @dceejay I'll look into it. The **json-db-node-red** is working very nicely, after that slight hiccup where I can make a copy before modifying.

As for the @mickym2 -- I can't find the **node-json-db** you mention when searching the pallets.

I'm running node-red 2.0.5. I tried updating to get the MQTT dynamic config but having a slight issue. Maybe node-json-db is in the latest?

thanks.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [29 January 2022 21:58 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/26 "2022-01-29T21:58:53Z")

</div>

The nodes **json-db-node-red** are based on [node-json-db](https://github.com/Belphemur/node-json-db).

If you look in this library, then you will see that delete function from this library is not implemented in the nodes. Therefore my idea was to work directly with this library.

---

<div class="post-metadata">

**Author:** ![knowledgeshark](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knowledgeshark/32/4820_2.png) [@knowledgeshark](https://discourse.nodered.org/u/knowledgeshark)\
**Post date:** [29 January 2022 22:04 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/27 "2022-01-29T22:04:32Z")

</div>

thanks, will look into that next. I though the node "pallet" should show all the valid installable nodes?

As for deleting .. the best I can offer is to update the "key" to something unused, so it can't be found later. Maybe that would work?  
thanks.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [29 January 2022 22:12 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/28 "2022-01-29T22:12:02Z")

</div>

May be, there is a misunderstanding - the nodes work and are stable.

I am missing in the nodes the delete function, which is offered by the underlying library. Best would be the in the Database In Node - would accept a message like msg.delete with a value of the path to delete the topic, so as implemented in the library:

```auto
// Deleting data
db.delete("/test1");

```

so if the Database In Node would accept a msg.delete = "/test1" this would supplement the node with the missing functionality.

However why I can't create objects from an external library is still open - but I will create a new thread for this problem.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 March 2022 22:12 UTC](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435/29 "2022-03-30T22:12:10Z")

</div>

Closed on 30 March 2022 22:12 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/json-db-node-red-keeping-object-that-wasnt-stored-persistently/57435.md?page=1)
