nedb
nedb copied to clipboard
insert document with Float32Array inside
Hello!
I have a document , one of its properties is Float32Array.
ex document before insert:
{
name: 'Test',
data: Float32Array [ 0.00045, -0.122, ... ]
}
After insert:
{
name: 'Test',
data: {
"0": 0.00045,
"1": -0.122,
...
}
}
Is there are any way to keep the array as [0.00045, -0.122, ...] and not converting it to object with numeric properties?
Thank you and best regards!
NeDB does not know what "Float32Array" is, which is why you're getting an error. And arrays can't be assigned that way. Basically, what you want is something like this (as a solution):
{
name: 'Test',
data: { Float32Array: [ 0.00045, -0.122, ... ] }
}
Data is now pointing to an object, where its first key ("Float32Array") points to an array. So then you can retrieve one of the array-values like this: data.Float32Array[ 0 ] // This would return 0.00045
and so on.