loopback-next
loopback-next copied to clipboard
Cassandra UDT not being persisted in cassandra database
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