Closed ceau74 closed 3 years ago
You can use .get() instead of .select() to get the an array of the internal objects (key values). Use .first() if you only want one object not wrapped in an array.
I believe you can use Object.entries() (native JavaScript) to get the key names. TaffyDB assumes you are controlling what you put in and get out of the DB so it doesn't have a lot of internal methods of data discovering if you are loading up unpredictable objects. In any case doing db().first().entries() should give you the keys back. If it doesn't in your context you can do a loop like this:
for (property in object) {
console.log(${property}: ${object[property]}
);
}
Hello.
1- How to get or to convert the result from select("field1","field2") for each row into object (key : value), because select() return an array of values. 2- How to get the key name of each object from an array.
Thank you so much.