Google Cloud Datastore dataset starter, part of a starter collection:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
'use strict'; var params = { projectId: 'MY_PROJECT', keyFilename: '/path/to/key/file.json', namespace: 'MY_NAMESPACE' }; var dataset = require('gcloud').datastore.dataset(params); var kind = 'MY_KIND'; var key = dataset.key(kind); var data = [ { name: 'title', value: 'Google Cloud Datastore Starter', excludeFromIndexes: false } ]; var entity = { key: key, data: data }; dataset.save(entity, function (err) { if (err) { throw err; } });
|