Hi There
The following function updates “character” one by one
How can I get “update” as a “character_list” and update it all at once?
static update(user_uuid: string, character: Character): Promise<any> {
return new Promise<any>((resolve: () => void, reject: (error_code: error.ERROR_CODE) => void) => {
const query: string = util.format("update `game` use keys '%s_HOME' set character_list[idx]= %s for idx : c in character_list when c.uuid = '%s' end",
user_uuid, JSON.stringify(character), character.uuid);
couch_helper.query("game", query)
.then((rows: Array<any>) => {
resolve();
return;
})
.catch((error_code: error.ERROR_CODE) => {
return reject(error_code);
});
});
}