Search code examples
javascriptnode.jsdatastore

Can't run .value() on non-existant property of non-existant object


i use stormdb my database structure:

(id == 1)

[id]: {
    text: [
      "example", "text"
    ],
    pictures: ["111"],
    chance: {
      "global": 20,
      "demotivator": 10,
      "poll": 10,
      "mem": 10,
      "sticker": 10,
      "bugurt": 10,
      "anekdot": 10
    },
    isGold: false
  }

i want to push in "text" string "hello", use this:

db.get(`conversations`).get(1).get("text").push("hello").save();

but i have error: Error: Can't run .value() on non-existant property of non-existant object.

what can i do?


Solution

  • This means your database is not stored or named the way you think it is.
    You might have created it wrong.

    Try each of these:


    console.log( db.get( 'conversations' ).value() );
    

    If it fails, your database does not exist.


    console.log( db.get( 'conversations' ).get( 1 ).value() );
    

    If it fails, there is no id '1' entry.


    console.log( db.get( 'conversations' ).get( 1 ).get( "text" ).value() );
    

    If it fails, your 'text' list does not exist.


    This will tell you what part of your database or entry is missing.