From 58fda9d7e1513f484bd052bb85e52727ed8680b2 Mon Sep 17 00:00:00 2001 From: Daniel Mewes Date: Tue, 19 May 2015 11:04:19 -0700 Subject: [PATCH 1/2] Replace returnVals by returnChanges --- todo-angular-express-promise/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/todo-angular-express-promise/app.js b/todo-angular-express-promise/app.js index a1ae92e..ccd52b2 100644 --- a/todo-angular-express-promise/app.js +++ b/todo-angular-express-promise/app.js @@ -43,7 +43,7 @@ function create(req, res, next) { var todo = req.body; todo.createdAt = r.now(); // Set the field `createdAt` to the current time - r.table('todos').insert(todo, {returnVals: true}).run(req._rdbConn).then(function(result) { + r.table('todos').insert(todo, {returnChanges: true}).run(req._rdbConn).then(function(result) { if (result.inserted !== 1) { handleError(res, next)(new Error("Document was not inserted.")); } @@ -60,7 +60,7 @@ function create(req, res, next) { function update(req, res, next) { var todo = req.body; if ((todo != null) && (todo.id != null)) { - r.table('todos').get(todo.id).update(todo, {returnVals: true}).run(req._rdbConn).then(function(result) { + r.table('todos').get(todo.id).update(todo, {returnChanges: true}).run(req._rdbConn).then(function(result) { res.send(JSON.stringify(result.new_val)); }).error(handleError(res)) .finally(next); From 8b257d6097b6289cdd03733aa36a153369e62525 Mon Sep 17 00:00:00 2001 From: Daniel Mewes Date: Tue, 19 May 2015 11:05:27 -0700 Subject: [PATCH 2/2] Replace returnVals by returnChanges (angular app) --- todo-angular-koa/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/todo-angular-koa/app.js b/todo-angular-koa/app.js index 2a0418d..72c039e 100644 --- a/todo-angular-koa/app.js +++ b/todo-angular-koa/app.js @@ -63,7 +63,7 @@ function* create(next) { try{ var todo = yield parse(this); todo.createdAt = r.now(); // Set the field `createdAt` to the current time - var result = yield r.table('todos').insert(todo, {returnVals: true}).run(this._rdbConn); + var result = yield r.table('todos').insert(todo, {returnChanges: true}).run(this._rdbConn); todo = result.new_val; // todo now contains the previous todo + a field `id` and `createdAt` this.body = JSON.stringify(todo); @@ -84,7 +84,7 @@ function* update(next) { throw new Error("The todo must have a field `id`."); } - var result = yield r.table('todos').get(todo.id).update(todo, {returnVals: true}).run(this._rdbConn); + var result = yield r.table('todos').get(todo.id).update(todo, {returnChanges: true}).run(this._rdbConn); this.body = JSON.stringify(result.new_val); } catch(e) {