So, I've been using webOS a long, long time, and I've never really had a need to store an array of objects, inside the database, as far as I can recall. I've recently had a need to do that, and I've noticed that the database adds an "_id" field to every object inside the array.
Anyone happen to know if this is documented anywhere, or what the specific reason for it is? I can't recall ever running into it before. It's not a problem, just something I wasn't aware of, and am curious about.
Hey Eric,
I have no idea if you were pasting actual code or pseudo, but that luna service call doesn't have harmonized open/closing brackets: 3x { & 2x }, 2x [ & 1x ]
...maybe that helps?
i didn't paste it from a command prompt, i just retyped a quick example. Yeah, you're right, I'm missing a bracket at the end.
I'm just curious what the extra id field inside the arrays is for. I assume there's a reason for it, but it wouldn't surprise me if no one can recall a specific.
Under the DB8 section on the Architecture page, it explains that “the structure of [a] key-value store” is how the database supports data storing and retrieving. When you add an array, the DB adds _id as a key for the array objects so it can easily reference them when storing and retrieving.
Interesting. I wonder if that means I can directly access an object inside an array, using it's _id property, exactly as if it were a top-level object?