Thursday 27 April 2017

How do I convert a CLOB object returned over waterline to a JSON object?

In DB: I have defined a CLOB column in my table, which is a JSON object that can get quite large.

In Sails App model: I have defined the table and i retrieve it using

MyModel.find({},function (err, found) {
  // The table contents are successfully retrieved into an array, no WLError is returned  
})

Then I tried to convert the array to JSON using

res.send(JSON.stringify(processesData));

Which resulted in the following error

NJS-003:connection invalid

Then I tried iterating over the array copying it into an object, then I realized that the CLOB column object for this does not contain any JSON looking properties, only some informative properties.

The question is... What is the right way to retrieve a CLOB object using sails/watterline ? Is there some kind of a different flow for retrieving->converting to json of CLOB objects? Searched for info on this and could not find any.



via Tomas Katz

No comments:

Post a Comment