3 print('| troupeId | uri | userId | username |');
5 var aggregation = db.troupes.aggregate([
26 localField: 'bans.userId',
27 foreignField: 'userId',
32 $unwind: '$troupeUsers'
37 userId: '$troupeUsers.userId',
40 match: { $eq: ['$troupeUsers.troupeId', '$_id'] }
57 $unwind: '$bannedUser'
64 username: '$bannedUser.username'
69 aggregation.toArray().forEach(function(row) {
70 print('| ' + row._id + ' | ' + row.uri + ' | ' + row.userId + ' | ' + row.username);