Skip to content

datastore: accept entity object to mutation methods#1804

Merged
callmehiphop merged 1 commit intogoogleapis:masterfrom
stephenplusplus:spp--1803
Nov 17, 2016
Merged

datastore: accept entity object to mutation methods#1804
callmehiphop merged 1 commit intogoogleapis:masterfrom
stephenplusplus:spp--1803

Conversation

@stephenplusplus
Copy link
Contributor

Fixes #1803

To make get & updating entities easier:

Before

datastore.get(key, function(err, entity) {
  entity.color = 'red'

  datastore.save({
    key: entity[datastore.KEY],
    data: entity
  }, function(err) {})
})

After

datastore.get(key, function(err, entity) {
  entity.color = 'red'
  datastore.save(entity, function(err) {})
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants