
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Odemongo is an ODM for MongoDB.
It allows you to work with multiple databases with a custom model.
Odemongo brings a you a class that you can use to connect to a DB. \
import { Database } from "odemongo"
const db = new Database(mongodb_url)
await db.connect()
A model allows to you to interact with an especific database and an especific collection.
It also allows you to validate data with zod.
Just by passing a zod schema odemongo will validate it and in case of error it will return it.
import { Model } from "odemongo"
const YOUR_MODEL = new Model(db, zod_schema, collection_name)
Now you can use all of the functions that Odemongo brings you with your model.
All the functions that receive data return an object with a result and an error and are asynchronous.
The find functions only return a result.
If there is a validation error the message will be in error and result will be null.
If validation is correct result will contain all the data and error will be false.
Options are all the default options that the MongoDB NodeJS driver has.
const { result } = await Model.find()
Result is an array
const { result } = await Model.findOne({ name: "John Doe" })
Result is an object
const { result } = await Model.findById(id)
Id must be an string that is 24 characters long, Odemongo will turn it into an ObjectId.
Result is an object
const { result, error } = await Model.insert({ name: "John Doe" })
The object will be validated before inserting in the collection.
Result is the inserted object
const { result, error } = await Model.insertMany([{ name: "John doe" }])
The objects in the array will be validated before inserting them.
Result is the inserted array
const { result, error } = await Model.update({ name: "John Doe" }, { name: "John Doe 2" })
The object will be partially validated, if the query doesn't match any object in the DB it will return null.
Result is the updated object
const { result, error } = await Model.updateById(id, { name: "John Doe 2" })
Same as update but the query is now an object.
Result is the updated object
const { result, error } = await Model.delete({name: "John Doe"})
If query doesn't match any object result will be null.
Result is the deleted object.
const { result, error } = await Model.deleteById(id)
Same as delete but query is an id.
Result is the deleted object.
Odemongo brings you some default zod schemas to work with specific data
import { schemas } from "odemongo"
import { z } from "zod"
import { schemas } from "odemongo"
const userSchema = z.object({
name: z.string(),
someId: schemas.ObjectIdSchema
})
This allows you to add custom ids to your schemas
Created by @ivanglzr
FAQs
Odemongo is an ODM for MongoDB
The npm package odemongo receives a total of 1 weekly downloads. As such, odemongo popularity was classified as not popular.
We found that odemongo demonstrated a healthy version release cadence and project activity because the last version was released less than 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.