Reading a text file, manipulating it and saving it to a mongo database
Style

Comments are just noise and thus reduce readability if they state what is obvious in the code. EG the comment //Read from each line is followed by the line
lineReader.eachLine(filePath, (line)=&gt; {

Do not mix styles. You use semicolons randomly in the code. Use them or not, do not mix them

Do not add empty blocks or as your comment describes  &quot;do nothing&quot;  . Example if (line.includes('ATTACK LOG')) { } else  should be if (!line.includes('ATTACK LOG')) {

Do not add magic numbers or string in the code. Define them as constants in one place

Always delimite statement blocks with {}. EG for(let i of attackData) i &amp;&amp; tempAttackData.push(i); should be  for(const i of attackData) { i &amp;&amp; tempAttackData.push(i) }

Use constants for variables that do not change

Single argument arrow functions do not need the () around the argument. EG (line)=&gt; { can be line =&gt; {

Spaces between commas

Undeclared variable are dangerouse. The variables finalResults, attackData, tempAttackData, cleanedAttackData and removedDateTime are all undecalared and thus are part of the top level scope and may clash creating very hard to debug problems

Avoid single use variables. EG  finalResults = new Results(result); finalResults.save(); can be new Results(result).save();

i is used as a loop counter and should not be used to represent a value or item of an array. The loop for (let i of ... should be for (const item of...

Do not add arguments to a function if that argument is not used. EG tempAttackData.forEach((data, index) =&gt; You do not use index so there is no need to define it


Logic
The whole thing feels clumsy as you move data from array to array, variable to variable, and step over and into nested and superfluous statements blocks.
It can be greatly simplified by creating a few helper functions to separate the various tasks. See example.
There also seams to be a bug as you do not check if the line is the second header line (contains &quot;---- LOOT -----&quot;).
Example
The example breaks the task into smaller functions reducing the overall source code (and executional) complexity.
The additional item at the end of the data line is just ignored (rather than popped from the array) by the function Attack which creates the attack object you save.
const LOGS = &quot;/retrieve-logs&quot;;
const message = &quot;Results successfully loaded&quot;;
const FILE_PATH = &quot;AttackLog-2019-10.log&quot;;    
const FIELDS = &quot;accountNumber,timeOfAttack,trophies,searches,ds,gold,elixir,darkElixir,trophyChange,victory,damagePercentage,bonusGold,bonusElixir,bonusDarkElixir&quot;;
const Attack = new Function(...FIELDS.split(&quot;,&quot;), &quot;return {&quot; + FIELDS + &quot;};&quot;);

const valid = line =&gt; ! [&quot;ATTACK LOG&quot;, &quot;GOLD&quot;, &quot;LOOT&quot;].some(mark =&gt; line.includes(mark));
const clean = line =&gt; line.slice(22).replace(&quot;||&quot;, &quot;|&quot;);
const parse = line =&gt; Attack(...clean(line).split(&quot;|&quot;).map(item =&gt; item.trim())); 

router.get(LOGS, (req, res) =&gt; {        
    lineReader.eachLine(FILE_PATH, line =&gt; { valid(line) &amp;&amp; new Results(parse(line)).save() });
    Results.find({}, (err, success) =&gt; { res.status(200).send({message, success}) });
});