Help get this topic noticed by sharing it on Twitter, Facebook, or email.

writing to multiple collections from server code

i am creating a signup. The registration server code needs to write to 4 different collections: Col-A, Col-B, Col_C, and Col-D.

what server code syntax will allow me to effectively update/add data to each of these collections? I've followed this code:

/ Database API key can be found in Settings tab in Database
var databaseId = "your_database_id";
var username = request.get("username");
var password = request.get("password");
var email = request.get("email");
var country = request.get("country");

// create user
var userLoginInfo = DatabaseUser.signUp(databaseId, {
"username": username,
"password": password
});

// create UserProfile
var userProfileInfo = Collection.createObject(databaseId, "UserProfile", {"email":email,"country":country});

// link
DatabaseUser.update(databaseId, userLoginInfo._id,{"to_userProfile":{"collName":"UserProfile", "_id":userProfileInfo._id}},userLoginInfo.sessionToken);

var user = {"username":username,"email":email,"country":country};

response.success(user, "application/json");

But as you see, this is only for one collection (userProfile). So let's say that this code allow writing to collection A and and B. How do I uodate/create data on Cols C and D?

Thanks
1 person has
this question
+1
Reply