Last active
July 3, 2016 17:39
-
-
Save lauramorillo/4d8a91a22994d76b856cdd57fd8f6ebb to your computer and use it in GitHub Desktop.
Example for reading from Google Cloud Datastore with two fields
This file contains 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
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