store only id for number builds projection

This commit is contained in:
oleg 2015-07-15 11:19:22 +03:00
parent c2db37b285
commit ae860ad54e
2 changed files with 8 additions and 3 deletions

6
db.js
View File

@ -17,13 +17,13 @@ exports.init = function(dbPath, params, callback) {
descCreateDate: descCreateDate,
id: 1
}},
// note that's unordered projection (coz number is numeric)
// TODO: pick only id as value for that rare used projection
// note that's unordered projection (coz number is numeric),
// it also contains only id
{key: {
projectName: pickProjectName,
number: 1,
id: 1
}},
}, value: pickId},
{key: {
projectName: pickProjectName,
status: 1,

View File

@ -33,6 +33,7 @@ exports.init = function(params, callback) {
exports._getPrevBuild = function(build, callback) {
Steppy(
function() {
// get id of prev build
db.builds.find({
start: {
projectName: build.project.name,
@ -41,6 +42,10 @@ exports._getPrevBuild = function(build, callback) {
limit: 1
}, this.slot());
},
function(err, builds) {
// get prev build by id
db.builds.find({start: {id: builds[0].id}}, this.slot());
},
function(err, builds) {
this.pass(builds[0]);
},