# Multiple stores in localfilesystem

**URL:** https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818
**Category:** General
**Created:** [1 March 2021 14:29 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818 "2021-03-01T14:29:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)
#### Post date: [1 March 2021 14:29 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/1 "2021-03-01T14:29:19Z")

</div>

I have implemented 2 stores in localfilesystem, in order to better handle my persistent global variables. This is in settings. js:

```auto
contextStorage: {
        lilioStore: { module: "localfilesystem"},
        lilioStoreLuci: { module: "localfilesystem"},
        default : { module: "memory" }
    },

```

Now, if I watch at the global context in the admin window, I find each variable duplicated, once in each store, with different values!

i.e.:

![Schermata 2021-03-01 alle 15.26.41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/49e909d4016f68c8827011fd69d8dccc2db7e6c7.png)

What is happening?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [1 March 2021 14:41 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/2 "2021-03-01T14:41:30Z")

</div>

Each store is a separate store of context data.

When you read/write context, you need to pay attention to which store you are using.

[https://nodered.org/docs/user-guide/writing-functions#multiple-context-stores](https://nodered.org/docs/user-guide/writing-functions#multiple-context-stores)

---

<div class="post-metadata">

### Author: ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)
#### Post date: [1 March 2021 15:06 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/3 "2021-03-01T15:06:05Z")

</div>

Yes, of course I am really paying attention, but as you can see from the screenshot, in that view the variables are duplicated. If I look into .node-red/context/global/global.json they are single, not duplicated. Only in that view in the admin page there is this weird list.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [1 March 2021 15:54 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/4 "2021-03-01T15:54:15Z")

</div>

If you want two different file stores, you need to make sure you give one of them a different `dir` or `base` setting - [Local Filesystem Context Store : Node-RED](https://nodered.org/docs/api/context/store/localfilesystem)

Otherwise the two stores will share the same location on disk and overwrite each other.

What you are seeing in the sidebar is a result of this.

---

<div class="post-metadata">

### Author: ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)
#### Post date: [1 March 2021 16:28 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/5 "2021-03-01T16:28:06Z")

</div>

I will separate the dirs but the weird thing is that currently there is only one instance for each variable in the file. Not in the side view of the admin page.

---

<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 April 2021 16:29 UTC](https://discourse.nodered.org/t/multiple-stores-in-localfilesystem/41818/6 "2021-04-30T16:29:05Z")

</div>

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