
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ym-mongodb-sql
Advanced tools
将 mongodb 的 json 参数转换为 sql 语句,通过较少的更改实现mogodb数据库向 mysql 数据库的迁移
npm i ym-mongodb-sql
或者可通过 npm 的 github 安装方式安装模块
npm i fanyingmao/ym-mongodb-sql
let ym = require("ym-mogodb-sql");
let {sql, valueArr} = ym.find("tlf_user", {
$or: [{email: {$regex: "*", $options: 'g'}, eail: {$regex: "*", $options: 'g'}}],
$nor: [{mobile: {$regex: "*", $options: 'g'}, emil: {$regex: "*", $options: 'g'}}],
id: {$in: [1, 2, "3"]}
}, {name: 1});
console.log("sql : " + sql);
console.log("valueArr : " + valueArr);
// sql : select name from tlf_user where (email regexp ? or eail regexp ?) and !(mobile regexp ? or emil regexp ?) and id in (?,?,?);
// valueArr : *,*,*,*,1,2,3
let ym = require("ym-mogodb-sql");
let {sql, valueArr} = ym.delete("tlf_user", {
$or: [{email: {$regex: "*", $options: 'g'}, eail: {$regex: "*", $options: 'g'}}],
$nor: [{mobile: {$regex: "*", $options: 'g'}, emil: {$regex: "*", $options: 'g'}}],
id: {$in: [1, 2, "3"]}
});
console.log("sql : " + sql);
console.log("valueArr : " + valueArr);
// sql : delete from tlf_user where (email regexp ? or eail regexp ?) and !(mobile regexp ? or emil regexp ?) and id in (?,?,?);
// valueArr : *,*,*,*,1,2,3
let ym = require('ym-mogodb-sql');
let {sql, valueArr} = ym.update('tlf_user', {
$or: [{email: {$regex: '*', $options: 'g'}, eail: {$regex: '*', $options: 'g'}}],
$nor: [{mobile: {$regex: '*', $options: 'g'}, emil: {$regex: '*', $options: 'g'}}],
id: {$in: [1, 2, '3']}
},{name : 'mysql',email:'123456@qq.com'});
console.log('sql : ' + sql);
console.log('valueArr : ' + valueArr);
// sql : update tlf_user set name = ?,email = ? where (email regexp ? or eail regexp ?) and !(mobile regexp ? or emil regexp ?) and id in (?,?,?);
// valueArr : mysql,123456@qq.com,*,*,*,*,1,2,3
let ym = require('ym-mogodb-sql');
let {sql, valueArr} = ym.insert('tlf_user',{name : 'mysql',email:'123456@qq.com'});
console.log('sql : ' + sql);
console.log('valueArr : ' + valueArr);
// sql : insert into tlf_user (name,email) values (?,?);
// valueArr : mysql,123456@qq.com
其它方法和查询条件当前项目未用到所以还有待开发
import MongodbSql from 'ym-mogodb-sql'
let res = MongodbSql.find("tlf_user", { id: { $in: [] } }, { name: 1 });
console.log('sql : ' + res.sql);
console.log('valueArr : ' + res.valueArr);
FAQs
mongodb change sql
We found that ym-mongodb-sql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.