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.
ODM is a new, innovative and easy way to use MongoDB documents, as Models, in your code. It uses the JSON schema standard for validating the documents.
odm.connect('mongodb://127.0.0.1:27017/simple');
var Person = odm.model("persons", {
"type" : "object",
"properties": {
"name": {"type": "string"},
}
});
We embed an address model in person:
// Address, to be embedded on Person
var Address = odm.model({
"id": "Simple#Address",
"type" : "object",
"properties": {
"lines": {
"type": "array",
"items": {"type": "string"}
},
"zip": {"type": "string"},
"city": {"type": "string"},
"country": {"type": "string"}
}
});
The changed person model:
var Person = odm.model("persons", {
"type" : "object",
"properties": {
"name": {"type": "string"},
"address": {"$ref": "Simple#Address"}
}
});
Parses a JSON string to a JSON document. It is aware of ISO Dates and ObjectIds and coverts them on the fly.
Finds one document or fields
, satisfying query
.
Person.findOne({'name': 'Barack Obama'}, function (error, document) {
if (error) {
console.log("error", error);
}
console.log(document);
});
Finds one document by id
, returining fields
.
Person.findById("4ff3fcf14335e9d6ba000001", function (error, document) {
if (error) {
console.log("error", error);
}
console.log(document);
});
Finds all documents or fields
, satisfying query
.
Person.find({'name': 'Barack Obama'}, function (error, documents) {
if (error) {
console.log("error", error);
}
console.log(documents);
});
Finds all documents or fields
.
Person.findAll(function (error, documents) {
if (error) {
console.log("error", error);
}
console.log(documents);
});
Removes all documents satisfying query
.
Update all documents satisfying query
, with document.
Loads one Id or array of ids, it is similar to a simple find, however the number of results and order is the same as the array argument
Adds an index and will also add a findByXXX
method, where XXX is the name of the fieldOrSpec
Returns true or false, or all errors in case verbose
is true.
Saves the instance model.
p.save(function (error, id) {
if (error) {
console.log("error", error);
}
console.log(id);
});
Update the instance model.
Insert the instance model.
Remove the instance model.
FAQs
ODM mongodb library for node.js
The npm package p-odm receives a total of 21 weekly downloads. As such, p-odm popularity was classified as not popular.
We found that p-odm 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.