You probably don't want to use an aggregate here but if you do you'll want to use a $match clause to search two fields. You query above will return all rows concatenating the two names fields you mention.
Example : insert these data
db.users.insert ( { first_name: "Salil", last_name: "Kumar Agrawal" } );
db.users.insert ( { first_name: "Shivam", last_name: "Kumar Pandey" } );
Using a standard find...
db.users.find( { first_name: "Shivam", last_name: "Kumar Pandey" } );
Returns...
{
"_id" : ObjectId("567902a425d93f0f90c5bc9c"),
"first_name" : "Shivam",
"last_name" : "Kumar Pandeyl"
}
Using aggregate...
db.users.aggregate([ { "$match": { first_name: "Shivam", last_name: "Kumar Pandeyl" } } ]);
Returns...
{
"_id" : ObjectId("567902a425d93f0f90c5bc9c"),
"first_name" : "Shivam",
"last_name" : "Kumar Pandeyl"
}
Your aggregate query returns the following...
{ "_id" : ObjectId("567902a425d93f0f90c5bc9c"), "userName" : "Salil - Kumar Agrawal" }
{ "_id" : ObjectId("567902b325d93f0f90c5bc9d"), "userName" : "Shivam - Kumar Pandey" }