3 var persistence = require('gitter-web-persistence');
4 var shutdown = require('shutdown');
5 var es = require('event-stream');
6 var csv = require('fast-csv');
7 var fs = require('fs');
9 persistence.Troupe.find({ oneToOne: true })
15 es.map(function(room, callback) {
16 if (room.users.length !== 2) return callback();
19 userA: '' + room.users[0].userId,
20 userB: '' + room.users[1].userId
24 .on('end', function() {
25 setTimeout(function() {
26 shutdown.shutdownGracefully();
29 .pipe(csv.createWriteStream({ headers: true }))
30 .pipe(fs.createWriteStream('one-to-ones.csv'));