Support Topics Documentation Slack YouTube Blog

Error "Multiple objects provided for a one-to-one relation" for 1:N relation!

Hi guys.
my app id 4BAEABFC-6FEF-EB39-FFE3-162B0D48F300
I’m having quite a weird error.
I’m running this in browser console (logged as user with all needed rights):
Backendless.Data.of(“negotiations”).setRelation({“objectId”:“8FBC362A-AE31-6F86-FF3C-2A6606359100”}, “inv_negotiations”, [‘BE6D73B8-934C-3AEC-FFC0-112B2482AA00’,‘99EFD145-8D2C-7363-FF7C-43516E8DA900’])
.then( function( res ) {
console.log( "res: ", res );
})
.catch( function( err ) {
console.log( "error ", err );
})

and I’ve got this error:
Unable to create relation. Multiple objects provided for a one-to-one relation identified by column ‘inv_negotiations’.
the thing is, column inv_negotiations is (and always was) one-to-many column!
(I tried setRelation and addRelation - same results)
So, what is it?

I’m not sure, if I understood well, but the tutorial in:
https://backendless.com/docs/dotnet/data_set_relation_with_object_dotnet.html

says you have to add cardinality explicitly to the relationColumnname, meaning
setRelation({"…"}, “inv_negotiations:n”

Hi, @yuriy!

Sorry for inconvince. This problem is caused by bug in old import/export logic by which, I think, this tables was created. Internal ticket BKNDLSS-21881 was created for this problem.

I will try to figure out how to fix it in your db.

Regards, Andriy

is there chance it will be fixed in my db during weekend? Otherwise I need to think of some workaround

I already looking at it.

I think that it will be fixed in 1-2 hours. I inform you when I finish.

Regards, Andriy

@yuriy, can you check your logic now?

working fine now, thanks!