Skip to content

minanagehsalalma/FBDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert Text files to Datebase Using TypeScript and MongoDB

Setup

Steps to run it

  • install Git Bash
  • copy target files into a new folder
  • Open Git Bash in that new folder, if it doesn't already show in the right click menu then check this
  • type split `TargetFileName` `NewFileName` -l `number of lines` -a 3 -d without the backticks. an ex of number of lines 50000
  • create a new folder named "txt" in the project folder and copy the output files into it
  • open the app.ts and replace the filePaths with the new output files names can be done using this

Final step

  • make sure that mongodb compass is running and click connect
  • then type in the terminal npm run dev in the project folder where the app.ts file is located

To decode the hex encoded strings

Do this for first time only

  • type npm install -g ts-node typescript '@types/node' in a terminal

To run the decoding code

  • replace the f1.txt in decode.ts with target file
  • ts-node decode.ts

Note :

in this db we use the phone numbers as ids as primary keys since a single account can have more than one number which would result in user already exists error in mongodb

How it looks after it's finished :

  • Searching Takes less than Milliseconds Capture Capture1 337070504_1598488140627904_5328762965454889630_n
DBdemo.mp4

About

Convert Text file to DB Using TypeScript and MongoDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published