1.0.8 • Published 4 years ago

@aggregion/mongo-like-query-to-sql v1.0.8

Weekly downloads
100
License
ISC
Repository
github
Last release
4 years ago

mongo-like-query-to-sql

A tool to convert a mongo-like query to SQL string

Installation

npm i -s @aggregion/mongo-like-query-to-sql

Usage

import {objToSQL} from '@aggregion/mongo-like-query-to-sql';

console.log(objToSQL({
  $and: [{
    $or: [
      {age: {$hasAny: [35, 40]}},
      {age: {$gte: 20, $lte: 30}},
    ],
  }, {
    'settle.population': {$gte: 10000, $lte: 50000},
  }],
}));

// Outputs: '(((((hasAny(age, [35, 40]))) OR ((age >= 20 AND age <= 30)))) AND ((settle.population >= 10000 AND settle.population <= 50000)))'

Issue a new package version

./issue.js 1.0.7 # replace with a relevant version number

Running the above script in case of success will also trigger a github action automatically publishing new npm package version.

1.0.8

4 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.2

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago