bashnesnos
bashnesnos

Reputation: 816

Schema can't initialize with "Can't find field id ..." exception

I need a hand here, it seems I'm getting things wrong.

I'm constantly getting the following after auth:

java.lang.IllegalStateException: Can't find field id customer.accountId

at org.tarantool.TarantoolConnection16Base.schema(TarantoolConnection16Base.java:214)

I thought ok, may be there is no meta data because there is no data in the space. So I've added a record with all fields, but the error persists.

So how is it supposed to work? Tarantool records are tuples, where I can store any amount of fields, so I thought fields in the field-mapping are basically an enumeration, where only order counts. Where I'm wrong?

Upvotes: 1

Views: 478

Answers (1)

dgreen
dgreen

Reputation: 101

Did u forget space.format? The example below set that first field has name 'id' and type 'num' and the second field has name 'text' and type 'str'

space = box.schema.space.create('tester')

box.space.tester:create_index('primary', {type = 'hash', parts = {1, 'NUM'}})

box.space.tester:format{{name='id',type='num'},{name='text',type='str'}}    

Upvotes: 4

Related Questions