This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rl = readline.createInterface({ | |
input: req, | |
// output: process.stdout | |
}); | |
// | |
rl.on('line', (input) => { | |
req.pause(); | |
addToDB(input).then(()=>{ | |
req.resume(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addToDB = async (data) => { | |
let arrItem; | |
let result; | |
arrItem = data.replace(/"/g, '').split(';'); | |
if (arrItem.length === 19) { | |
const _id = new Types.ObjectId(); | |
const infoObj = { | |
person: arrItem[0], |