Skip to content

Instantly share code, notes, and snippets.

@lauramorillo
Last active July 3, 2016 17:39
Show Gist options
  • Save lauramorillo/4d8a91a22994d76b856cdd57fd8f6ebb to your computer and use it in GitHub Desktop.
Save lauramorillo/4d8a91a22994d76b856cdd57fd8f6ebb to your computer and use it in GitHub Desktop.
Example for reading from Google Cloud Datastore with two fields
function usersByNameAndGreaterAge(name, age){
return new Promise((resolve, reject) => {
console.log(name.constructor.name + age.constructor.name);
const query = datastore.createQuery('Users')
.filter('name', name)
.filter('age', '>=', age);
datastore.runQuery(query, (err, users) => {
if (!err) {
resolve(users);
} else {
reject(err);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment