Skip to content

Commit

Permalink
Merge pull request #13 from rethinkdb/daniel_11
Browse files Browse the repository at this point in the history
Replace returnVals by returnChanges
  • Loading branch information
deontologician committed May 20, 2015
2 parents 937b399 + 8b257d6 commit cbe726b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions todo-angular-express-promise/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
}
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions todo-angular-koa/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit cbe726b

Please sign in to comment.