File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,6 +148,31 @@ dataset = gcloud.datastore.dataset({
148148dataset .get (dataset .key ([' Product' , ' Computer' ]), function (err , entity ) {
149149 console .log (err || entity);
150150});
151+
152+ // Save data to datastore
153+ var blogPostData = {
154+ title: ' How to make the perfect homemade pasta' ,
155+ tags: [' pasta' , ' homemade' ],
156+ author: ' Silvano' ,
157+ isDraft: true ,
158+ wordCount: 450 ,
159+ };
160+
161+ var theKey = ds .key (' BlogPost' );
162+
163+ dataset .save ({
164+ key: theKey,
165+ data: blogPostData
166+ }, function (err ) {
167+ // theKey has been updated with an id so you can
168+ // do more operations with it. Such as an update:
169+ dataset .save ({
170+ key: theKey,
171+ data: { isDraft: false }
172+ }, function (err ) {
173+ // The blog post is now published!
174+ });
175+ });
151176```
152177
153178## Google Cloud Storage
You can’t perform that action at this time.
0 commit comments