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
indexes: | |
# AUTOGENERATED | |
# This index.yaml is automatically updated whenever the Cloud Datastore | |
# emulator detects that a new type of query is run. If you want to manage the | |
# index.yaml file manually, remove the "# AUTOGENERATED" marker line above. | |
# If you want to manage some indexes manually, move them above the marker line. | |
- kind: "Users" | |
properties: |
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 { |
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
var gcloud = require('gcloud')({ | |
projectId: 'testing-project', | |
apiEndpoint: 'http://localhost:8080' | |
}); | |
function createUser(userData){ | |
return new Promise((resolve, reject) => { | |
const key = datastore.key(['Users', userData.dni]); | |
datastore.save({ key: key, data: userData }, err => { | |
if (!err) { |