Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@synatic/sql-to-mongo

Package Overview
Dependencies
Maintainers
11
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synatic/sql-to-mongo - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

42

lib/make/projectColumnParser.js

@@ -144,11 +144,5 @@ const getParsedValueFromBinaryExpressionModule = require('./getParsedValueFromBinaryExpression');

}
if (column.expr.type && column.as) {
if (column.as === '$$ROOT') {
result.replaceRoot = {
$replaceRoot: {newRoot: `$${column.expr.value}`},
};
return;
}
result.parsedProject.$project[column.as] = {
$literal: column.expr.value,
if (column.as && column.as === '$$ROOT') {
result.replaceRoot = {
$replaceRoot: {newRoot: `$${column.expr.value}`},
};

@@ -158,16 +152,26 @@ return;

if (
(column.expr.type === 'double_quote_string' ||
column.expr.type === 'string') &&
!column.as
column.expr.type === 'double_quote_string' ||
column.expr.type === 'string' ||
column.expr.type === 'single_quote_string'
) {
const parts = column.expr.value.split('.');
if (!column.as) {
if (parts.length !== 2) {
throw new Error(
`Require as for calculation or <table>.<column>:${
column.expr.name || column.expr.value
}`
);
}
const colName = parts[1];
result.parsedProject.$project[colName] = `$${column.expr.value}`;
return;
}
if (parts.length !== 2) {
throw new Error(
`Require as for calculation or <table>.<column>:${
column.expr.name || column.expr.value
}`
);
result.parsedProject.$project[column.as] = {
$literal: column.expr.value,
};
return;
}
const colName = parts[1];
result.parsedProject.$project[colName] = `$${column.expr.value}`;
result.parsedProject.$project[column.as] = `$${column.expr.value}`;
return;

@@ -174,0 +178,0 @@ }

{
"name": "@synatic/sql-to-mongo",
"version": "1.0.6",
"version": "1.0.7",
"description": "Convert SQL to mongo queries or aggregates",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc