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 #553DescriptionHow 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);
Activityjgeewax commented on May 8, 2015 ryanseys commented on May 8, 2015 Perhaps we should add a few more examples to the dataset#save docs to address these different cases. byrneciaran commented on May 8, 2015 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. jgeewax commented on May 8, 2015 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.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|