Support Topics Documentation Slack YouTube Blog

bulk setRelation


(Yuriy) #1

we have bulkCreate / bulkUpdate for mass operations, and they work good, but typical database structure usually have relations with other tables. So, we also need bulkSetRelation (I guess order of items are preserved in output of bulkCreate, which ids could be used as one of arguments in bulkSetRelation)


(Sergey Kukurudzyak) #2

Hello Yuriy,

do you like to tie one parent with couple objects, or couple parent objects with couple child objects?
please provide full curl request that would appropriate for this use case


(Yuriy) #3

Well, in described case there would be several parents (returned ids from bulkCreate). Not sure about question with curl request. I’m using javascript sdk, so I would like to have something like:

var persons = [];//there should be objects for bulkCreate
var childrenArray1 = [];//there should be ids of objects for relation
var childrenArray2 = [];//there should be ids of objects for relation
Backendless.Data.of("Person").bulkCreate(persons)
.then( function( res ) {
    return Backendless.Data.of("Person").bulkSetRelation(
    res, //parentObject array,
    "relationColumn1",
    childrenArray1)
})
.then( function( res ) {
    return Backendless.Data.of("Person").bulkSetRelation(
    res, //parentObject array,
    "relationColumn2",
    childrenArray2)
})

(Sergey Chupov) #4

Hi Yuriy,
Currently we only provide a method to set relation between a single parent and multiple child. So there is no “bulkSetRelation” yet. We’ll discuss the possibility of adding this.