# Stable variable

**URL:** <https://forum.dfinity.org/t/stable-variable/29404>\
**Category:** Motoko\
**Created:** [April 7, 2024, 9:32am UTC](https://forum.dfinity.org/t/stable-variable/29404 "2024-04-07T09:32:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaxopaxo](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jaxopaxo](https://forum.dfinity.org/u/jaxopaxo)\
**Post date:** [April 7, 2024, 9:32am UTC](https://forum.dfinity.org/t/stable-variable/29404/1 "2024-04-07T09:32:02Z")

</div>

Hi!  
I am sorry if as simple question, but I am migrating from relational databases thinking to ICP way 🙂  
My question is how to declare the below as a stable  
var myData = HashMap.HashMap\<Principal, [DataModel]\>(0, Principal.equal, Principal.hash);

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [April 8, 2024, 8:32am UTC](https://forum.dfinity.org/t/stable-variable/29404/2 "2024-04-08T08:32:13Z")

</div>

`mo:base/HashMap` is not a stable data structure so you can’t declare it with `stable var`. I suggest you use something like [Mops • Motoko Package Manager](https://mops.one/stablehashmap) instead
