[SOLVED] This is a question about mongo queries and function's parameters


#1

Can I use function parameter as field in a mongo query ?

Example:

var x = function( field , value ){
return Collection.find( { field: value } );
}
the ‘value’ parameter it s working in the query but the ‘field’ parameter it isnt.


#2
var x = function( field , value ){
  var selector = {};
  selector[field] = value;
  return Collection.find(selector);
}