progaudi/progaudi.tarantool

byte[] data type

Closed this issue · 8 comments

How an array[] data type can be defined and which data type does it match on db side?

What do you mean by "array[] data type"? Just use .net arrays, they would be serialized as array in msgpack and stored as arrays in db. The only way to index them is RTREE index, AFAIK. And it's limited to array of int or doubles (coordinates).

Sorry, byte[] I intend to

You just use byte[], it will be serialized as Binary data type into msgpack and will be saved as single binary field into database. You'll be able to treat it like a lua string, I think. I didn't check, sorry.

I checked. it didn't. what should I define the type of field in db? Is it 'string' or 'array'?

Please, provide code you use and versions of connector and tarantool.

connector: 0.11.0
tarantool: 1.7.6-11-gcd17b77f9
code:
[MsgPackArrayElement(0)]
public byte[] Field1 { get; set; }

db:
box.space.some_space:format({ {name='Field1', type='array'} })

Type "array" has meaning only for int[] to represent some geometric coordinates. https://tarantool.io/en/doc/1.7/book/box/data_model.html#data-types

For storing byte[] I would skip datatype or set it to string.

Skipping datatype did the trick, thanks.