Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent result returning back from datastore.get (promise vs callback) #2253

Closed
taoalpha opened this issue Apr 24, 2017 · 2 comments
Closed
Assignees
Labels
api: datastore Issues related to the Datastore API. type: question Request for information or clarification. Not an issue.

Comments

@taoalpha
Copy link

datastore.get with callback will return the entity, while promise format will return the array of entities...

@taoalpha
Copy link
Author

promise:

ds.get(ds.key(["Account", args.id])).then(console.log).catch(console.log)
Promise { pending }
[ { settings: '{}',
    created: 2017-04-24T21:26:54.427Z,
  }]

vs callback:

ds.get(ds.key(["Account", args.id]), (err, entity) => console.log("===>", err, entity))
undefined
===> null { settings: '{}',
  created: 2017-04-24T21:26:54.427Z}

@stephenplusplus
Copy link
Contributor

Duplicate: #2167

@stephenplusplus stephenplusplus added api: datastore Issues related to the Datastore API. type: question Request for information or clarification. Not an issue. labels Apr 24, 2017
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. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants