Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ez.database
Advanced tools
Ez.Database is an extremely light, and straightforward MongoDB Database wrapper.
Ez.Database was created to make the process of using MongoDB very easily, and quickly, so that even a complete beginner could understand how a Database works, and get started using one.
Beginner Friendly - It's very easy for a beginner to use our db, and it only takes a few seconds to get setup, and connect to MongoDB.
Light - Ez.Database is extremely light, comprised with only a few files, which makes it very fast to run.
Simplifies Schemas - The package simplifies Schemas, and instead uses the set, has, and get method, to simplify the process, making it easy to set, check, and get data.
After you have initialized node, run this command:
npm install ez.database
With our step by step Guide, you can get started in seconds!
For the full API documentation, please visit our website, at WEBSITENAME.
To get the project started, run the command npm init -y, to initalize your project as node:
npm init -y
After that, please run the installation command for our Database.
To setup a Database, please visit MongoDB's Website. Next, click login, and from there, click sign up. You can either create and account, or sign up with Google.
Next, we're going to install MongoDB Compass. Compass is good for visualising and understanding data, and query syntax. It also makes managing your Databases and Collections easier. To install it, visit the Compass Download Page, and click download.
When Compass is finished installing, open it up. You should see a screen where you need to paste your connection string.
To get the connection string, we need to make a Cluster, which we are going to connect to in Compass. Please go to the MongoDB website.
There should be a screen which says Clusters, Create a New Cluster, and many more things. Click on the Create a New Cluster button. You can specify your Cloud Provider and Region, but for free access, select a region with the symbol FREE TIER AVAILABLE, and ideally one close to where you are, for better connection. You can specify your Cluster name, then hit Create Cluster.
It should take a few seconds/minutes to create. Meanwhile, we're going to create a user, so we can authenticate into our Cluster.
Click the Database Access button. There, add a new Database User, and make the user's name, and password, and click Add User.
Once your Cluster is finished being made, click the Connect button, and select Connect using MongoDB Compass. There, you will see your connection string. Copy it. Finally, go back to Compass, and paste your connection string. You will need to replace the password text, with your user password.
Note: You can only have one free Cluster. If you would like to create an additional Cluster, you have to pay a small fee to MongoDB.
Now, you need to create a Database. Click the Create Database button, and specify your Database and Collection name. Next, click Create Collection, and specify your collection name.
You are now all set up with MongoDB! Let's see how to use Ez.Database!
Getting started using Ez.Database is very easy, and takes a few seconds.
In order to connect to MongoDB, we need to make a variable for our connection string. Since the connection string is a sensitive piece of information, we are going to store it in a seperate JSON file. Name that file ConnectionString.json.
Make a file called MongoConnectionString.json, which will hold the string. Paste the following code into that file:
{
"MongoConnectionString": "yourconnectionstring"
}
You'd use the same connection string you used to connect in MongoDB Compass.
Now, make a file called db.js. Here, paste the following code:
const { MongoConnectionString } = require('./ConnectionString.json')
const EzDatabase = require('ez.database')
const db = new EzDatabase()
db.connect(MongoConnectionString,
console.log('Connected to Database')
)
How does this work? First, we're requiring the MongoConnectionString object, from our JSON file. The technique used is called Object Destructuring.
Then, we require the actual Ez.Database module. After that, we make a variable called db, which is an instance of the Ez.Database class.
Next, we use the connect method, to connect to our MongoDB database, while passing in our connection string to do so. We also log the message we want when we have connected to MongoDB.
Ez.Database simplifies the process of creating Schemas, and instead just uses the set, get, and has methods. Add the follow code to your file:
const { MongoConnectionString } = require('./ConnectionString.json')
const EzDatabase = require('ez.database')
const db = new EzDatabase()
db.connect(MongoConnectionString,
console.log('Connected to Database')
)
//What you're adding
db.set('Dataset', {data: object})
db.get(Dataset.data)
db.has(Dataset.Data)
db.save()
The set method sets Data, and you can set your Dataset name. It also takes 2 parameters. The first one is the actual Dataset name, and the second is the property and object.
The get method gets Data, from a specific Dataset, and access the property and object in that Dataset.
The has method returns either true, or false. It's used for checking if a certain Dataset has some data.
Finally, the save method saves all of your data, to the Database.
Ez.Database has two Dependencies:
Future updates will be written here.
Please share the package with your friends, and hope you found Ez.Database useful!
FAQs
Easy to use and lightweight MongoDB Wrapper Database for beginners.
The npm package ez.database receives a total of 1 weekly downloads. As such, ez.database popularity was classified as not popular.
We found that ez.database 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.