Skip to content

Commit 0d14250

Browse files
author
Jonathan Wayne Parrott
committed
Merge pull request GoogleCloudPlatform#37 from GoogleCloudPlatform/fix-datastore
Fixing datastore pagination issue
2 parents 9de2b5a + 8be1d51 commit 0d14250

18 files changed

Lines changed: 90 additions & 90 deletions

File tree

1-hello-world/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"express": "^4.13.3"
3232
},
3333
"devDependencies": {
34-
"jshint": "^2.8.0"
34+
"jshint": "^2.9.1"
3535
},
3636
"engines": {
3737
"node": ">=0.12.7"

2-structured-data/books/model-datastore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function(config) {
4141
// property: value
4242
// }
4343
function fromDatastore(obj) {
44-
obj.data.id = obj.key.path[obj.key.path.length - 1];
44+
obj.data.id = obj.key.id;
4545
return obj.data;
4646
}
4747

@@ -95,9 +95,9 @@ module.exports = function(config) {
9595
.order('title')
9696
.start(token);
9797

98-
ds.runQuery(q, function(err, entities, cursor) {
98+
ds.runQuery(q, function(err, entities, nextQuery) {
9999
if (err) { return cb(err); }
100-
var hasMore = entities.length === limit ? cursor : false;
100+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
101101
cb(null, entities.map(fromDatastore), hasMore);
102102
});
103103
}

2-structured-data/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
],
3030
"license": "Apache Version 2.0",
3131
"dependencies": {
32-
"body-parser": "^1.14.1",
32+
"body-parser": "^1.14.2",
3333
"express": "^4.13.3",
34-
"gcloud": "^0.24.0",
34+
"gcloud": "^0.27.0",
3535
"jade": "^1.11.0",
36-
"kerberos": "^0.0.17",
37-
"lodash": "^3.10.1",
38-
"mongodb": "^2.0.46",
39-
"mysql": "^2.9.0",
36+
"kerberos": "^0.0.18",
37+
"lodash": "^4.0.0",
38+
"mongodb": "^2.1.4",
39+
"mysql": "^2.10.2",
4040
"prompt": "^0.2.14"
4141
},
4242
"devDependencies": {
43-
"jshint": "^2.8.0"
43+
"jshint": "^2.9.1"
4444
},
4545
"engines": {
4646
"node": ">=0.12.7"

3-binary-data/books/model-datastore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function(config) {
3939
// property: value
4040
// }
4141
function fromDatastore(obj) {
42-
obj.data.id = obj.key.path[obj.key.path.length - 1];
42+
obj.data.id = obj.key.id;
4343
return obj.data;
4444
}
4545

@@ -92,9 +92,9 @@ module.exports = function(config) {
9292
.order('title')
9393
.start(token);
9494

95-
ds.runQuery(q, function(err, entities, cursor) {
95+
ds.runQuery(q, function(err, entities, nextQuery) {
9696
if (err) { return cb(err); }
97-
var hasMore = entities.length === limit ? cursor : false;
97+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
9898
cb(null, entities.map(fromDatastore), hasMore);
9999
});
100100
}

3-binary-data/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
},
3030

3131
// Typically, you will create a bucket with the same name as your project ID.
32-
cloudStorageBucket: 'your-cloud-storage-bucket',
32+
cloudStorageBucket: 'your-bucket-name',
3333

3434
mysql: {
3535
user: 'your-mysql-user',

3-binary-data/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@
2929
],
3030
"license": "Apache Version 2.0",
3131
"dependencies": {
32-
"body-parser": "^1.14.1",
32+
"body-parser": "^1.14.2",
3333
"express": "^4.13.3",
34-
"gcloud": "^0.24.0",
34+
"gcloud": "^0.27.0",
3535
"jade": "^1.11.0",
36-
"kerberos": "^0.0.17",
37-
"lodash": "^3.10.1",
38-
"mongodb": "^2.0.46",
36+
"kerberos": "^0.0.18",
37+
"lodash": "^4.0.0",
38+
"mongodb": "^2.1.4",
3939
"multer": "^1.1.0",
40-
"mysql": "^2.9.0",
40+
"mysql": "^2.10.2",
4141
"prompt": "^0.2.14"
4242
},
4343
"devDependencies": {
44-
"jshint": "^2.8.0"
44+
"jshint": "^2.9.1"
4545
},
4646
"engines": {
4747
"node": ">=0.12.7"

4-auth/books/model-datastore.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function(config) {
3939
// property: value
4040
// }
4141
function fromDatastore(obj) {
42-
obj.data.id = obj.key.path[obj.key.path.length - 1];
42+
obj.data.id = obj.key.id;
4343
return obj.data;
4444
}
4545

@@ -92,9 +92,9 @@ module.exports = function(config) {
9292
.order('title')
9393
.start(token);
9494

95-
ds.runQuery(q, function(err, entities, cursor) {
95+
ds.runQuery(q, function(err, entities, nextQuery) {
9696
if (err) { return cb(err); }
97-
var hasMore = entities.length === limit ? cursor : false;
97+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
9898
cb(null, entities.map(fromDatastore), hasMore);
9999
});
100100
}
@@ -108,9 +108,9 @@ module.exports = function(config) {
108108
.limit(limit)
109109
.start(token);
110110

111-
ds.runQuery(q, function(err, entities, cursor) {
111+
ds.runQuery(q, function(err, entities, nextQuery) {
112112
if (err) { return cb(err); }
113-
var hasMore = entities.length === limit ? cursor : false;
113+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
114114
cb(null, entities.map(fromDatastore), hasMore);
115115
});
116116
}

4-auth/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
},
3333

3434
// Typically, you will create a bucket with the same name as your project ID.
35-
cloudStorageBucket: 'your-cloud-storage-bucket',
35+
cloudStorageBucket: 'your-bucket-name',
3636

3737
mysql: {
3838
user: 'your-mysql-user',

4-auth/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@
2929
],
3030
"license": "Apache Version 2.0",
3131
"dependencies": {
32-
"async": "^1.5.0",
33-
"body-parser": "^1.14.1",
32+
"async": "^1.5.2",
33+
"body-parser": "^1.14.2",
3434
"cookie-session": "^2.0.0-alpha.1",
3535
"express": "^4.13.3",
36-
"gcloud": "^0.24.0",
37-
"googleapis": "^2.1.5",
36+
"gcloud": "^0.27.0",
37+
"googleapis": "^2.1.7",
3838
"jade": "^1.11.0",
39-
"kerberos": "^0.0.17",
40-
"lodash": "^3.10.1",
41-
"mongodb": "^2.0.46",
39+
"kerberos": "^0.0.18",
40+
"lodash": "^4.0.0",
41+
"mongodb": "^2.1.4",
4242
"multer": "^1.1.0",
43-
"mysql": "^2.9.0",
43+
"mysql": "^2.10.2",
4444
"prompt": "^0.2.14"
4545
},
4646
"devDependencies": {
47-
"jshint": "^2.8.0"
47+
"jshint": "^2.9.1"
4848
},
4949
"engines": {
5050
"node": ">=0.12.7"

5-logging/books/model-datastore.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function(config) {
3939
// property: value
4040
// }
4141
function fromDatastore(obj) {
42-
obj.data.id = obj.key.path[obj.key.path.length - 1];
42+
obj.data.id = obj.key.id;
4343
return obj.data;
4444
}
4545

@@ -92,9 +92,9 @@ module.exports = function(config) {
9292
.order('title')
9393
.start(token);
9494

95-
ds.runQuery(q, function(err, entities, cursor) {
95+
ds.runQuery(q, function(err, entities, nextQuery) {
9696
if (err) { return cb(err); }
97-
var hasMore = entities.length === limit ? cursor : false;
97+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
9898
cb(null, entities.map(fromDatastore), hasMore);
9999
});
100100
}
@@ -108,9 +108,9 @@ module.exports = function(config) {
108108
.limit(limit)
109109
.start(token);
110110

111-
ds.runQuery(q, function(err, entities, cursor) {
111+
ds.runQuery(q, function(err, entities, nextQuery) {
112112
if (err) { return cb(err); }
113-
var hasMore = entities.length === limit ? cursor : false;
113+
var hasMore = entities.length === limit ? nextQuery.startVal : false;
114114
cb(null, entities.map(fromDatastore), hasMore);
115115
});
116116
}

0 commit comments

Comments
 (0)