Forum

Com.webos.service.db/merge documentation error?

Attempting to use the 'merge' function to update a piece of data in the database, I get the following error back

  payload:
   { errorCode: -3969,
     errorText: 'db: kind not specified',
     returnValue: false },

Error -3969 is not documented, nor is the behavior that i'm seeing:

I was giving

{ objects: [ { id: '...', ... } ] }

which, you may spot the error: "id" should be "_id". I'm not sure why specifying a "_kind" is acceptable when not specifying an "_id". As well, it asked me to insert the rest of the schema -- was the database attempting to do a /mergePut instead of a merge? Does /merge automatically fall to /mergePut ?

I'm confused -- I'd have expected it to error that I did not supply an _id to update, but it instead errors that I did not supply a _kind.

On top of all of that -- it's looking for "_kind", not "kind", as the error message suggests.

So, the documentation could use the error message, and a lot of clarification on exactly what behavior was going on there.

I'd also like to point out that if you attempt to merge using an object id, and that id doesn't exist, you get back a very cryptic error: "db: kind not specified". Of course i didn't specify a kind, I specified an id.. but the id wasn't valid. :slight_smile:

This one looks like a slightly larger failure

# luna-send -n 1 -f luna://com.webos.service.tempdb/merge '{"props":{}}'
{
    "errorCode": 22,
    "returnValue": false,
    "errorText": "invalid parameters: caller='com.webos.lunasend-27783' error='required prop not found - 'query' for property 'props''"
}

not about merge, but if you attempt to pass any function looking for an "_id" a value that contains a hyphen, you get back {"errorCode":-995,"errorText":"invalid base64 data","returnValue":false}