GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — datastore: Support commit mutation methods on top level of dataset · Issue #208 · googleapis/google-cloud-node

datastore: Support commit mutation methods on top level of dataset #208

New issue
Copy link
New issue
Copy link
Closed
#218
Closed
datastore: Support commit mutation methods on top level of dataset#208
#218
Copy link
Assignees
ryanseys
Labels
🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.
Milestone
Datastore Stable

Description

@ryanseys
ryanseys
opened on Sep 12, 2014
Issue body actions

Should support commit mutations as top level methods in dataset.
It just makes sense:

dataset.upsert(key, properties, function(err, result) {});
dataset.update(key, properties, function(err, result) {});
dataset.insert(key, properties, function(err, result) {});
dataset.insertAutoId(key, properties, function(err, result) {});
dataset.delete(key, function(err) {});

Activity

Next
  1. stephenplusplus commented on Sep 12, 2014

    @stephenplusplus
    stephenplusplus
    on Sep 12, 2014
    Contributor
    More actions

    +1. Users would probably appreciate explicit control.

    And bonus, we support delete already!

  2. stephenplusplus commented on Sep 12, 2014

    @stephenplusplus
    stephenplusplus
    on Sep 12, 2014
    Contributor
    More actions

    What's the difference between insert and insertAutoId? Will calls to insert with incomplete keys throw an exception? Will calls to insertAutoId throw if there are complete keys?

  3. ryanseys commented on Sep 12, 2014

    @ryanseys
    ryanseys
    on Sep 12, 2014
    ContributorAuthor
    More actions

    From the docs: "To have the Datastore assign a numeric ID automatically, omit both the name and id fields and place the entity in the insertAutoId (JSON) or insert_auto_id (protocol buffers) field of the mutation"

  4. stephenplusplus commented on Sep 12, 2014

    @stephenplusplus
    stephenplusplus
    on Sep 12, 2014
    Contributor
    More actions

    Sure, but how do you propose we handle our implementation? (The last two questions)

  5. ryanseys commented on Sep 12, 2014

    @ryanseys
    ryanseys
    on Sep 12, 2014
    ContributorAuthor
    More actions

    Will calls to insert with incomplete keys throw an exception?

    If we are missing required information from the key, return an error in the callback (don't throw).

    Will calls to insertAutoId throw if there are complete keys?

    Again, no throwing, use the callback to return errors. An error will occur if they provide too little information, not too much.

  6. ryanseys commented on Sep 12, 2014

    @ryanseys
    ryanseys
    on Sep 12, 2014
    ContributorAuthor
    More actions

    We can assume that if they call insertAutoId, then we just include the information relevant to that call i.e. ignore the name and id fields if they are specified.

  7. stephenplusplus commented on Sep 12, 2014

    @stephenplusplus
    stephenplusplus
    on Sep 12, 2014
    Contributor
    More actions

    I think I'm starting to think differently towards this proposal. I like the simplicity of our API. I think that's the point of making this nice abstraction. If we allow direct methods, we give the user too many options imo, and would be better recommending they use another library/combination of libraries for lower level access.

  8. ryanseys commented on Sep 13, 2014

    @ryanseys
    ryanseys
    on Sep 13, 2014
    ContributorAuthor
    More actions

    I don't see these as "low level access" but fundamental actions you commit to the data in the datastore. The problem with the current code-generated library is it's too high level. You commit a big json blob and that's interpreted as commands including these mutations.

    I'm proposing we extract those commands and give them to the user. Those 5 mutations are all I found. I don't think it's asking for much and it shows the developer what they can/cannot do with the datastore from a storage point of view (querying is a different issue).

  9. stephenplusplus commented on Sep 13, 2014

    @stephenplusplus
    stephenplusplus
    on Sep 13, 2014
    Contributor
    More actions

    fundamental actions you commit to the data in the datastore.

    We provide these actions. upsert, insert, insertAutoId, and update all result in an entity being inserted or updated, and these are all handled with save. I don't consider save to be doing much magic. You get the results you intend, based on what you provide.

    upsert: "I want to update this entity if it exists, otherwise create one."
    save: "give me a complete key or incomplete key"

    insert: "I want to insert this entity into the datastore."
    save: "give me a complete key or incomplete key"

    insertAutoId: "I want to create this entity and have an id generated for me."
    save: "give me an incomplete key"

    update: "I want to update this entity"
    save: "give me a complete key"

    So, I don't consider save a limiting factor. I think we would end up overwhelming the user by providing too many methods.

    I'm proposing we extract those commands and give them to the user.

    Maybe we can show the user more explicitly in our documentation how save works based on what it is given.

  10. ryanseys commented on Sep 13, 2014

    @ryanseys
    ryanseys
    on Sep 13, 2014
    ContributorAuthor
    More actions

    I didn't know save was doing all this. Yeah, an easy way to better the documentation is inline provide a bunch of complete / incomplete keys and what their effect on the datastore will be (i.e. create, update, autoId, etc)

  11. stephenplusplus
    added 4 commits that reference this issue on Sep 17, 2014

    feat(datastore): support setting a property indexed value

    This issue will close once commit ac6f1d0 is merged into the 'master' branch.
    ac6f1d0

    feat(datastore): support setting a property indexed value

    This issue will close once commit 0eaac00 is merged into the 'master' branch.
    0eaac00

    feat(datastore): support setting a property indexed value

    This issue will close once commit 0f68ccd is merged into the 'master' branch.
    0f68ccd

    feat(datastore): support setting a property indexed value

    This issue will close once commit 108b7a3 is merged into the 'master' branch.
    108b7a3
  12. ryanseys commented on Sep 18, 2014

    @ryanseys
    ryanseys
    on Sep 18, 2014
    ContributorAuthor
    More actions

    Closing. Seems save does all the magic.

  13. 61 remaining items

  14. GautamSharda
    added 3 commits that reference this issue on Feb 23, 2026

    chore(deps): update dependency nock to v10 (#208)

    9b4a618

    docs: Align session length with public documentation feat: Expose est…

    33410ad

    chore(deps): update dependency nock to v10 (#208)

    2c97b40
  15. sofisl
    added a commit that references this issue on Feb 26, 2026

    Rewrite PartialResultStream (#208)

    a80efd4
  16. codyoss
    added a commit that references this issue on Mar 5, 2026

    chore: add dev dependencies for cloud-rad ref docs (#208)

    9152f2c
  17. sofisl
    added 2 commits that reference this issue on Mar 5, 2026

    build: use config file for linkinator (#208)

    8c79021

    docs: updated code of conduct (includes update to actions) (#208)

    01b4c96
  18. codyoss
    added 3 commits that reference this issue on Mar 9, 2026

    chore: upgrade to gts v2 (#208)

    3d79efe

    chore: upgrade to gts v2 (#208)

    45a62e4

    chore(deps): update actions/checkout action to v3 (#1392) (#208)

    69d6886
  19. GautamSharda
    added a commit that references this issue on Mar 12, 2026

    fix(deps): update dependency pify to v4 (#208)

    c135bc0
  20. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    fix #196 should not call replaceProjectID token when projectid is pas…

    abcff8e

    fix #196 should not call replaceProjectID token when projectid is pas…

    7dcf75d
  21. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    fix #196 should not call replaceProjectID token when projectid is pas…

    983fbe8
  22. thiyaguk09
    added a commit that references this issue on May 5, 2026

    fix googleapis#196 should not call replaceProjectID token when projec…

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

Metadata

Metadata

Assignees

  • @ryanseys
    ryanseys

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    • Datastore Stable

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.