I am completely new to Mongo, so I'm sure there's something obvious that I'm missing. Despite searching online, I can't figure out why my MongoDB query in a JavaScript file isn't working.
Strangely enough, the projection part of the query is being ignored by Mongo, everything else seems to be functioning correctly.
criteria = ' { "powersave_enabled" : false, "tx_rate" : { $lt : 26000 }, "rx_rate" : { $lt : 26000 }, "btyes-r" : { $ne: 0 } } ';
projection = ' {"_id":0, "hostname" : 1, "rssi" : 1, "mac" : 1, "ap_mac" : 1, "noise" : 1} ';
command = criteria + ', ' + projection;
accessPoints = db.cache_sta.find(command);
while (accessPoints.hasNext()){
printjson( accessPoints.next() );
}
After printing and testing the command in mongo myself, it appears to be correct. There must be an issue with the JS code.
Any help would be greatly appreciated!