Last active
April 11, 2017 14:32
-
-
Save wayneashleyberry/5b9219346afbab974a263f4b073bd831 to your computer and use it in GitHub Desktop.
Datastore example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const datastore = require('@google-cloud/datastore')(); | |
const key1 = datastore.key(['Users', 1, 'Comments']); | |
const comment1 = { | |
userId: 1, | |
commentBody: '...', | |
ts: new Date(), | |
}; | |
const key2 = datastore.key(['Users', 2, 'Comments']); | |
const comment2 = { | |
userId: 2, | |
commentBody: '...', | |
ts: new Date(), | |
}; | |
datastore.save({ | |
key: key1, | |
data: comment1 | |
}, (err) => { | |
// | |
}); | |
datastore.save({ | |
key: key2, | |
data: comment2 | |
}, (err) => { | |
// | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment