javascript - Variable into mongodb query -


ok driving me crazy..

function(amount){  matchingorder = order.findone({         price: {           $lte: amount         }       }, {         sort: {           price: 1,           order_id: 1         }       });  } 

-----does not work

this works:

function(){  amount = 2  matchingorder = order.findone({         price: {           $lte: amount         }       }, {         sort: {           price: 1,           order_id: 1         }       });  } 

in both cases console.log(amount) 2 variable gets passed

...sorry maybe obvious scope or something..im relativly new @ this

the thing coming mind different types amount. try instead:

function(amount){  matchingorder = order.findone({         price: {           $lte: parseint(amount)         }       }, {         sort: {           price: 1,           order_id: 1         }       });  } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -