loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

Cassandra UDT not being persisted in cassandra database

Open nishankpathak opened this issue 2 years ago • 0 comments

Describe the bug

The code converts Json object in request payload to string for UDT. We debugged and found the issue with Cassandra.prototype.create function in loopback-connector-cassandra/lib/cassandra.js. Please provide the solution for the issue.

Logs

Payload object:
{
  id: 'c',
  name: 'otlsgy4',
  phone: '88774622572',
  address: {
    street: 'Sahastradhara Road',
    city: 'Dehradun',
    state_or_province: 'Uttarakhand',
    postal_code: '248001',
    country: 'India'
  }
}


Insert Query by loopback:
INSERT INTO "hotels"("id","name","phone","address") VALUES(?,?,?,?) [
  'c',
  'otlsgy4',
  '88774622572',
  '{"street":"Sahastradhara Road","city":"Dehradun","state_or_province":"Uttarakhand","postal_code":"248001","country":"India"}'
]

Expected Result: 
INSERT INTO "hotels"("id","name","phone","address") VALUES(?,?,?,?) [
  'c',
  'otlsgy4',
  '88774622572',
  {"street":"Sahastradhara Road","city":"Dehradun","state_or_province":"Uttarakhand","postal_code":"248001","country":"India"}
]

Additional information

No response

Reproduction

https://github.com/nishankpathak/cassandrademo

@dhmlau

nishankpathak avatar Feb 19 '22 15:02 nishankpathak