
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
simple-connection
Advanced tools
Connection using mongo native which desire to be an simple alternative to another communicattions - ES6 ready
A small implementation to use mongodb with native drives provided by mongodb, but with promises.
npm install simple-connection --save
Configuration object you can build url connection and the keys username and password are optional. Also you can send a query_params
key to build url connection with more mongo parameters.
In example you can found how to send configuration object and how to create a instance to use with simple-connection.
To improve performance this version left promises and use more operations and promises from mongodb package. This change make things a little different. Specially at find
operation, pay attention when use that and not forget close database after operations.
Another improve is all operations that mongodb package has, simple-connection support.
We made some changes more detail can be found here.
const DB = require('simple-connection');
const CONFIG = {
"protocol": "mongo+srv://", // it's optional, the default will be mongodb://
"username": process.env.MONGO_USER,
"password": process.env.MONGO_PASS,
"server": "127.0.0.1",
"port": 27017,
"database_name": "exampleTest"
};
const db = new DB(CONFIG);
const collection = db.open('yourCollection');
// to insert many pass an array with objects
collection('insert', { data: 'to insert' })
.then((success) => {
console.log(success);
}).catch((err) => {
console.log(err);
});
// Or if your prefer async/await
try {
const result = await collection('insert', ({ data: 'to insert' });
console.log(result);
} catch(error)
console.log(err);
};
collection('find', { data: 'to search' })
.then((dbResources) => {
dbResources.find.toArray().then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
});
collection('update', { data: 'to search' }, { data: 'to update' })
.then((success) => {
console.log(success);
}).catch((err) => {
console.log(err);
});
collection('remove', { data: 'to remove' }, options)
.then((success) => {
console.log(success);
}).catch((err) => {
console.log(err);
});
I've some plans to create a v4 with intents to have types.d.ts and some improvements in perfomance
FAQs
Simple connection wrapper to MongoDB using ES6 modules and ESM
We found that simple-connection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.