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 — Setting Property value types for Datastore Entities · Issue #553 · googleapis/google-cloud-node

Setting Property value types for Datastore Entities #553

New issue
Copy link
New issue
Copy link
Closed
Closed
Setting Property value types for Datastore Entities#553
Copy link
Assignees
jgeewax
Labels
api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Description

@byrneciaran
byrneciaran
opened on May 8, 2015
Issue body actions

How do I set Property value types (e.g. dateTimeValue, IntegerValue, etc.) when inserting my entities in the example below. At the moment the Property value types are all set as strings

var entry = {
    "title":"Title",
    "start":"2014-02-01T09:28:56.321-10:00"
};

var ds = gcloud.datastore.dataset();
var key = ds.key(['Entry', 'Foo', 'Todo']);

ds.save({
    key: key,
    data: entry
}, callback);

Activity

Next
  1. jgeewax
    added
    type: questionRequest for information or clarification. Not an issue.
    api: datastoreIssues related to the Datastore API.
    on May 8, 2015
  2. jgeewax commented on May 8, 2015

    @jgeewax
    jgeewax
    on May 8, 2015
    Contributor
    More actions

    I believe you can do this by passing in the actual Date type object. Looks like the conversion to the proper type in the request is done here: https://github.com/GoogleCloudPlatform/gcloud-node/blob/bc2b57ce4e2d84a8d2ff722d677ddfe681fc8d00/lib/datastore/entity.js#L380

    I also think that if you want to distinguish between Int and Double, you can use the gcloud.datastore.double and gcloud.datastore.int` methods (see http://googlecloudplatform.github.io/gcloud-node/#/docs/master/datastore)

    Ie, this should work

    var entry = {
        "title": "Title",
        "start": new Date(),
        "myDouble": gcloud.datastore.double(3.0)
    };
    
    var ds = gcloud.datastore.dataset();
    var key = ds.key(['Entry', 'Foo', 'Todo']);
    
    ds.save({
        key: key,
        data: entry
    }, callback);
  3. ryanseys commented on May 8, 2015

    @ryanseys
    ryanseys
    on May 8, 2015
    Contributor
    More actions

    Perhaps we should add a few more examples to the dataset#save docs to address these different cases.

  4. byrneciaran commented on May 8, 2015

    @byrneciaran
    byrneciaran
    on May 8, 2015
    Author
    More actions

    Ah ok, I admit I'm struggling to make sense of the documentation. I think the reason for this is that reading the general Datastore documentation for the first time (https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Properties_and_value_types) makes reference to doing something like:

    var entity = {
      key: { path: [{ kind: 'Employee' }] },
      properties: {
        firstName: { stringValue: 'Antonio' },
        lastName: { stringValue: 'Salieri' },
        hireDate: { dateTimeValue: '2013-05-14T13:01:00.234Z' },
        attendedHrTraining: { booleanValue: true }
      }
    };
    datastore.commit({
      mutation: { insertAutoId: [entity] },
      mode: 'NON_TRANSACTIONAL'
    }).execute(callback);

    which uses the googleapis module. Maybe it will help to clarify in the documentation the difference between using the googleapis module vs the gcloud module in Node as I'm finding I'm stumbling across both while searching for Datastore information on Node.

  5. jgeewax commented on May 8, 2015

    @jgeewax
    jgeewax
    on May 8, 2015
    Contributor
    More actions

    That's a great point @byrneciaran. I'm going to open another issue for us to put a banner saying that we're not the same as the googleapis module... Not sure how else we can clarify this without changing documentation on cloud.google.com (which we shouldn't really do until we hit v1.0). If you have any suggestions, definitely let us know!

    I'm going to close out this issue as I think we've answered the question, but feel free to re-open if you think that's a mistake, and follow #554 if you're interested in providing any feedback on the updates we're making to the documentation.

  6. jgeewax
    closed this as completedon May 8, 2015
  7. JustinBeckwith
    assigned
    jgeewax
    on Feb 1, 2021
  8. chingor13
    added 6 commits that reference this issue on Aug 22, 2022

    feat: add OSConfigZonalService API Committer: @jaiminsh (#553)

    37c302c

    chore: release 3.19.0 (#552)

    ab192d3

    feat: add OSConfigZonalService API Committer: @jaiminsh (#553)

    a1a8225

    chore: release 3.19.0 (#552)

    64139e8

    feat: add OSConfigZonalService API Committer: @jaiminsh (#553)

    f3df16d

    chore: release 3.19.0 (#552)

    592621c
  9. sofisl
    added a commit that references this issue on Sep 27, 2022

    fix: remove doc config exception (#553)

    872f964
  10. 21 remaining items

  11. GautamSharda
    added 2 commits that reference this issue on Feb 2, 2026

    fix: dedupe logs when using middleware (#553)

    84cf371

    fix: dedupe logs when using middleware (#553)

    57a5e00
  12. sofisl
    added a commit that references this issue on Feb 4, 2026

    build: switch to release-please release tagging (#1129) (#553)

    dae816e
  13. GautamSharda
    added a commit that references this issue on Feb 5, 2026

    chore: migrate to owl bot (#553)

    f67fb32
  14. GautamSharda
    added a commit that references this issue on Feb 23, 2026

    chore: migrate to owl bot (#553)

    5b9a885
  15. sofisl
    added a commit that references this issue on Feb 24, 2026

    refactor(typescript): enable noImplicitAny (#553)

    c169fe6
  16. GautamSharda
    added a commit that references this issue on Feb 26, 2026

    chore: migrate to owl bot (#553)

    f0406c0
  17. sofisl
    added a commit that references this issue on Feb 26, 2026

    chore(deps): update dependency @types/sinon to v7.0.9 (#553)

    003d66e
  18. GautamSharda
    added 3 commits that reference this issue on Mar 11, 2026

    fix(deps): update dependency p-defer to v2 (#553)

    a9eeb3a

    fix(deps): update dependency @google-cloud/projectify to v2 (#553)

    475c448

    chore: updated eslint and prettier configs (#561)

    6533813
  19. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    chore: update CONTRIBUTING.md and make releaseType node (#553)

    4d49a7b

    chore: update CONTRIBUTING.md and make releaseType node (#553)

    4f0da30
  20. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    chore: update CONTRIBUTING.md and make releaseType node (#553)

    8128d94
  21. thiyaguk09
    added a commit that references this issue on May 5, 2026

    chore: update CONTRIBUTING.md and make releaseType node (googleapis#553)

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

Metadata

Metadata

Assignees

  • @jgeewax
    jgeewax

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    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.