Closed ncmbadmin closed 8 years ago
SDKの改善にご協力いただきありがとうございます。 (Thank you for your support our SDK.)
SDKの不具合を報告する場合は、以下の項目を確認してください。 (If you want to report a bug of the SDK, please confirm the following terms.)
//Userのインスタンスを作成 var user = new ncmb.User(); // メールアドレスとパスワードでログイン ncmb.User.loginWithMailAddress("thuydg@gmail.com", "test") .then(function(user){ console.log("Login successfull"); console.log("Before updated:" + user.favorite) // ログイン後処理 var currentUser = ncmb.User.getCurrentUser(); currentUser.add("favorite", "newvalue"); currentUser.update() .then(function(currentUser){ // 保存後の処理 console.log("Updated done"); console.log("After update:" + currentUser.favorite); }) .catch(function(err){ // エラー処理 console.log("Update error: " +JSON.stringify(err)); }); }) .catch(function(err2){ // エラー処理 console.log("Login error: " +JSON.stringify(err2)); });
Login successfull Before updated:DVkWjscfaRJpzXh1,jqD8VyQiBjihpBgZ,tg5wFOLDG3l2iBnV,Fv1FoNEB2xBbwicn Updated done After update:undefined
``` addを使った配列要素の追加は、配列の実体を取得せずにデータストアの内容を書き換えるための処理になります。 実体を手元で操作して更新したい場合は、直接配列をuser.favorite.push("add param")のように操作して更新してください。
``` add
user.favorite.push("add param")
SDKの改善にご協力いただきありがとうございます。
(Thank you for your support our SDK.)
SDKの不具合を報告する場合は、以下の項目を確認してください。
(If you want to report a bug of the SDK, please confirm the following terms.)
不具合の概要(Description of bug)