Merge branch 'release/21.49.0' into master
[gitter.git] / scripts / user-etl.sh
blob82fb14d0f52adf84a4a12fab70edc43058c3d63a
1 #!/bin/bash
3 set -e
5 cat | while read line; do
6 USERNAME=`echo $line|cut -d, -f1`
7 DISPLAY_NAME=`echo $line|cut -d, -f2`
8 EMAILS=`echo $line|cut -d, -f3,4,5,6,7,8,9|sed -e 's/,/","/g'`
9 cat <<DELIM
10 print("$USERNAME");
11 db.users.update(
12 { username: "$USERNAME" },
13 { \$setOnInsert:
14 { username: "$USERNAME",
15 displayName: "$DISPLAY_NAME" },
16 \$set:
17 { emails: ["$EMAILS"].filter(function(f) { return f; }) }
19 { upsert: true });
20 DELIM
23 done