« first day (2716 days earlier)      last day (1386 days later) » 

1:58 AM
let vtv = Number(this.getField("VehicleTradeValue").valueAsString);

function adjustVTV(val, separator = ',', every = 3){
let vtv = +val.replace(/,/g, ''), n;
if(vtv < 5999){
vtv *= 2;
}
else if(vtv < 9000){
vtv *= 1.75;
}
else if(vtv < 11000){
vtv *= 1.5;
}
else if(vtv < 12000){
vtv *= 1.4;
}
else if(vtv < 13000){
vtv *= 1.35;
}
else if(vtv < 14000){
vtv *= 1.3;
}
else if(vtv < 17000){
vtv *= 1.25;
}
else if(vtv < 20000){
vtv *= 1.2;
}
else if(vtv < 24000){
vtv *= 1.15;
}
else{
vtv *= 1.1;
}
vtv = vtv.toFixed(2).split('.'); n = vtv[0].split('');
 
1 message moved from JavaScript
 
 
5 hours later…
7:07 AM
@Natty lol
 
 
1 hour later…
8:28 AM
Hello, I'm trying to call a method of a mongoose model in a function after passing it as an argument and it's not working, this is the full function:
function isIdTaken(model,id){
model.countDocuments({_id: id}, function(err,count){
if(!err){
if(count > 0){
return true;
} else {
return false;
}
} else {
console.log(err);
}
})
}
The model is supposed to be a constructor, from mongoose documentation, and the same method (.countDocuments()) works if the model is not passed as argument to a function. Can anyone help me understand what I'm doing wrong by chance?
 
1 message moved from JavaScript
1 message moved from JavaScript
 
 
5 hours later…
 
6 hours later…

« first day (2716 days earlier)      last day (1386 days later) »