I have a mongodb query in which I am requesting for a limited number of fields. But it is still returning the entire row. Can someone help?
collection.find(
{ username: searchterm },
{ username: 1 },
function(e, docs){
console.log('---- DB RESULT');
console.log(docs);
res.writeHead(200, {'content-type': 'text/json' });
res.write( JSON.stringify({ 'docs' : docs }) );
res.end('\n');
}
);