-
Notifications
You must be signed in to change notification settings - Fork 598
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
How do I interact with entities in Datastore? #568
Comments
Yeah the entity is an object with |
I think an (Here's the Python documentation for this: http://googlecloudplatform.github.io/gcloud-python/latest/datastore-entities.html) |
var entity = Entity(key: Key | String | Array, data: Object)
|
What about the "get and modify" process. Would that look like.... var companyKey = dataset.key(['Company', 123]);
dataset.get(companyKey, function(err, entity) {
entity.HQ = 'Houston, TX';
dataset.save(entity);
}); ? |
Yes, that would work. Currently we have: var companyKey = dataset.key(['Company', 123]);
dataset.get(companyKey, function(err, entity) {
entity.data.HQ = 'Houston, TX';
dataset.save(entity, callback);
}); I'm starting to wonder if an Entity type is a better solution than making sure we show more complete workflows in our Examples. |
Anyone else have thoughts here? // @callmehiphop? |
Looking at the old vs. new code samples, I don't really see any benefits in creating an Entity class. It sounds to me like our problem is that we need more documentation around interacting with entities. An Entity class could fix that, but I think it's the wrong way to go about it. |
I agree. I like using plain JS objects where possible, and this seems like a logical place. I think #574 will go a long way to answer the question we repeatedly hear: "How do I get the generated ID?" Regarding entities, users seem to be grasping how it works to store, get, and update. But, it couldn't hurt to add an example here: https://googlecloudplatform.github.io/gcloud-node/#/docs/v0.25.0/datastore/dataset?method=get |
* chore(main): release 3.0.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: googleapis/googleapis@7a12973 Source-Link: googleapis/googleapis-gen@370c729 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: googleapis/googleapis@7a12973 Source-Link: googleapis/googleapis-gen@370c729 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
PiperOrigin-RevId: 417752787 Source-Link: googleapis/googleapis@3e58417 Source-Link: googleapis/googleapis-gen@e9ad9d6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTlhZDlkNjM4NjAwNjM4YTAwYjA3MmZmYThkNDE4YTc4OThmMmQ0NiJ9 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Benjamin E. Coe <[email protected]>
chore: relocate owl bot post processor
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 474338479 Source-Link: googleapis/googleapis@d5d35e0 Source-Link: googleapis/googleapis-gen@efcd3f9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9
🤖 I have created a release *beep* *boop* --- ## [4.2.0](googleapis/nodejs-cloud-container@v4.1.3...v4.2.0) (2022-09-22) ### Features * Added High Throughput Logging API for Google Kubernetes Engine ([#571](googleapis/nodejs-cloud-container#571)) ([588b19a](googleapis/nodejs-cloud-container@588b19a)) ### Bug Fixes * Preserve default values in x-goog-request-params header ([#568](googleapis/nodejs-cloud-container#568)) ([575531f](googleapis/nodejs-cloud-container@575531f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [3.0.0](googleapis/nodejs-iot@v2.5.1...v3.0.0) (2022-06-20) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#566) ### Features * AuditConfig for IAM v1 ([#552](googleapis/nodejs-iot#552)) ([1b1a3d2](googleapis/nodejs-iot@1b1a3d2)) ### Bug Fixes * **deps:** update dependency @google-cloud/pubsub to v3 ([#569](googleapis/nodejs-iot#569)) ([77a2005](googleapis/nodejs-iot@77a2005)) * **deps:** update dependency @google-cloud/storage to v6 ([#568](googleapis/nodejs-iot#568)) ([b15efb4](googleapis/nodejs-iot@b15efb4)) ### Build System * update library to use Node 12 ([#566](googleapis/nodejs-iot#566)) ([1efe654](googleapis/nodejs-iot@1efe654)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/39538a75-dd2e-4f49-b972-60368d19d19d/targets - [ ] To automatically regenerate this PR, check this box.
* feat!: drop node8 support, support for async iterators BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. New feature: methods with pagination now support async iteration. * fix tests & linter Co-authored-by: Benjamin E. Coe <[email protected]> Co-authored-by: Xiaozhen Liu <[email protected]>
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/1630485f-7526-4afd-9c13-b5660664d6a2/targets
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/1630485f-7526-4afd-9c13-b5660664d6a2/targets
dataset.save()
seems to let me put some data, but how do I then get a hold of the persisted entity? Do we have documentation for this that I'm just missing?The text was updated successfully, but these errors were encountered: