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, descCreateDate: descCreateDate,
id: 1 id: 1
}}, }},
// note that's unordered projection (coz number is numeric) // note that's unordered projection (coz number is numeric),
// TODO: pick only id as value for that rare used projection // it also contains only id
{key: { {key: {
projectName: pickProjectName, projectName: pickProjectName,
number: 1, number: 1,
id: 1 id: 1
}}, }, value: pickId},
{key: { {key: {
projectName: pickProjectName, projectName: pickProjectName,
status: 1, status: 1,

View File

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