
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
documentdb-initializer
Advanced tools
This is a npm package to initialise and update a collection in document db. You can create and update store procedure, trigger and seed data in a collection using npm commandline.
Please refer to github for more detail.
npm install documentdb-initializer -g
docdb <config-file-path>
should be the realted path to the path you run the command (current wokrking directory).
Example of config file:
{
"url": "<url>",
"key": "<key>",
"database": "<databaseId>",
"collection": "<collectionId>",
"storedProcPath": "<path-to-storeProcs>",
"triggerPath": "<path-to-triggers>",
"documentPath": "<path-to-documents>",
"userDefinedFunctionPath": "<path-to-userDefinedFunction>"
}
###File Format
Stored proc, trigger, document and user defined function should be in one or multiple js files kept in your configured path. The js script should assign the script configuration object to a variable named objs.
Please refer to Microsoft Azure DocumentDB Node.js SDK Documentation for detail documentation of the configuration object.
Example of Stored Proc File:
var objs = [{
id: "helloWorld",
serverScript: function () {
var context = getContext();
var response = context.getResponse();
response.setBody("Hello, World");
}
},
{
id: "helloWorld2",
serverScript: function () {
var context = getContext();
var response = context.getResponse();
response.setBody("Hello, World2");
}
}]
Example of Trigger file:
var objs = [{
id: "validateName",
triggerType: "Pre",
triggerOperation: "All",
serverScript: function () {
var collection = getContext().getCollection();
var request = getContext().getRequest();
var docToCreate = request.getBody();
// Reject documents that do not have a name property by throwing an exception.
if (!docToCreate.name) {
throw new Error('Document must include a "name" property.');
}
}
}]
Example of Document file:
var objs = [
{
id: "testDocument1",
name: "testName1"
},
{
id: "testDocument2",
name: "testName2"
},
{
id: "testDocument3",
name: "testName3"
}
]
Example of UserDefinedFunction file:
var objs = [{
id: "tax",
serverScript: function tax(income) {
if(income == undefined)
throw 'no input';
if (income < 1000)
return income * 0.1;
else if (income < 10000)
return income * 0.2;
else
return income * 0.4;
}
}]
FAQs
A tool to initialise documentDb base on config
We found that documentdb-initializer 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.