1
votes

I am using following code in loopback 4 to have number (float) field, but I am not getting float in my DB:

@property({
  type: 'number',
  jsonSchema: {
    format: 'float',
  },
})
Field: number;

I am using MySQL database and loopback migrate with int(11) type (docs just have number)

Any Suggestions?

1

1 Answers

2
votes

You can use dataType as:

@property({
  type: 'number',
  dataType: 'FLOAT'
})
Field: number;