Socket
Socket
Sign inDemoInstall

@aggregion/mongo-like-query-to-sql

Package Overview
Dependencies
0
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aggregion/mongo-like-query-to-sql

Mongo-like to SQL query converter


Version published
Weekly downloads
12
Maintainers
6
Install size
17.2 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 15 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc