
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
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 22 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.