@jiiir/mongo2sql

1.0.1 • Public • Published

Mongo2SQL

Mongo2SQL is a lightweight MongoDB to SQL translator written in Typescript.

Screenshot

Installation

$ npm i @jreisz/mongo2sql

Example usage

import { MongoToSQLTranslator } from "@jreisz/mongo2sql";

const exampleQuery1 = { name: 'john' };
const exampleQuery2 = { _id: 23113 }, { name: 1, age: 1 };
const exampleQuery3 = { age: { $gte: 21 } }, { name: 1, _id: 1 };

console.log(MongoToSQLTranslator.translate(exampleQuery1));
console.log(MongoToSQLTranslator.translate(exampleQuery2));
console.log(MongoToSQLTranslator.translate(exampleQuery3));

Contributing

Changes and improvements are more than welcome! Feel free to fork and open a pull request. Please make your changes in a specific branch and request to pull into main! If you can, please make sure the translator fully works before sending the PR, as that will help speed up the process.

TODO

  • Complex Data Types (Date, ObjectId)
  • Add more Unit Tests
  • Improve design
  • Refactoring

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @jiiir/mongo2sql

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

20.5 kB

Total Files

7

Last publish

Collaborators

  • jiiir