A Node.js script for importing track data from Excel files into MongoDB using Mongoose. Written in TypeScript and fully tested with Mocha, Chai, and MongoMemoryServer.
- Parse Excel
.xlsx
files using ExcelJS - Map spreadsheet columns to MongoDB document fields
- Validate rows and report errors without stopping the import
- Automatically create a default contract (
Contract 1
) - Supports aliases as semi-colon separated values
- Fully tested with in-memory MongoDB
- Node.js >= 20
- MongoDB (for running against a real database)
- Npm for dependency management
- Clone the repository:
git clone <repository-url>
cd curve-track-script
- Install dependencies
npm install
- Create a
.env
file in the root folder:
MONGO_URI=mongodb://127.0.0.1:27017/curve-track-db
Replace the URI with your MongoDB connection string.
- Run the script
npm run importTracks
npm test