Here is a sample aggregation, that you can use to sort your sellers&buyers users by their user.name (or other fields):
const pipeline = [
// first, group ids of buyers and sellers
{
$group: {
_id: null,
buyersIds: {
$addToSet: '$buyer',
},
sellersIds: {
$addToSet: '$seller',
},
},
},
// then, concat grouped ids into single array
// to fetch users with one single $lookup
// ids in the array will not be unique,
// but that does not matter for $lookup
// PS: you can $unwind 'userIsds'
// and then $group them like we did with 'buyersIds' above,
// if unique values in 'usersIds' bother you :)
{
$project: {
usersIds: {
$concatArrays: ['$buyersIds', '$sellersIds'],
},
},
},
// use $lookup to join users by ids from accumulated array
{
$lookup: {
from: '',
localField: 'usersIds',
foreignField: '_id',
as: 'users',
},
},
// unwind 'users' to be bring out each user to upper level
{
$unwind: '$users',
},
// make each user a root object in the pipeline array
{
$replaceRoot: {
newRoot: '$users',
},
},
// sort user objects, like you want
{
$sort: {
name: 1,
},
},
];
To be able to sort by user email, that lays in the array, you will need to replace the $sort stage in above aggregation to this:
// destruct your emails array to be able to sort by its values
{
$unwind: '$emails',
},
// do the sort
{
$sort: {
name: 1,
emails: -1,
},
},
// re-construct user objects like they were before $unwind
{
group: {
_id: '$_id',
emails: {
$push: '$emails',
},
// and for the rest fields
sampleField: {
$first: '$sampleFields',
},
// ...
},
This will work, but it can be not as performant, as you may want 
Instead, consider adding redundancy to your documents:
{
// note, that ObjectId must link to _id from the collection,
// that you would do the $lookup from.
buyer: { _id, ObjectId, emails: [], name: 'Rob' },
seller: { _id, ObjectId, emails: [], name: 'Bob' },
// ... other fields
}
The above structure will allow sort buyers and sellers very fast and without $lookups and any aggregations. But, still, you will not be able to sort by ‘emails’ array.
With the above structure can do one of the following:
a) add ‘primaryEmail’ to buyer and seller objects and then you can sort by both fields: ‘name’ and ‘primaryEmail’. Additionally, you can use regex to search users that have part of a searched ‘name’/‘email’.
b) simply filter out users and to not have specified email with $in operator and then sort by ‘name’ field.