![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
mongodb-memory-server-core
Advanced tools
Package description
The mongodb-memory-server-core package provides an in-memory MongoDB server for testing purposes. It allows developers to spin up a MongoDB server instance that runs entirely in memory, making it ideal for unit tests and integration tests where a real MongoDB server would be overkill or too slow.
Start an In-Memory MongoDB Server
This feature allows you to start an in-memory MongoDB server instance. The code sample demonstrates how to create a new MongoMemoryServer instance and retrieve its URI.
const { MongoMemoryServer } = require('mongodb-memory-server-core');
(async () => {
const mongod = new MongoMemoryServer();
const uri = await mongod.getUri();
console.log(`MongoDB Server started at ${uri}`);
})();
Stop the In-Memory MongoDB Server
This feature allows you to stop the in-memory MongoDB server instance. The code sample demonstrates how to start and then stop the MongoMemoryServer instance.
const { MongoMemoryServer } = require('mongodb-memory-server-core');
(async () => {
const mongod = new MongoMemoryServer();
await mongod.start();
console.log('MongoDB Server started');
await mongod.stop();
console.log('MongoDB Server stopped');
})();
Use with Mongoose
This feature allows you to use the in-memory MongoDB server with Mongoose. The code sample demonstrates how to connect Mongoose to the in-memory MongoDB server, perform database operations, and then disconnect and stop the server.
const mongoose = require('mongoose');
const { MongoMemoryServer } = require('mongodb-memory-server-core');
(async () => {
const mongod = new MongoMemoryServer();
const uri = await mongod.getUri();
await mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true });
console.log('Mongoose connected to in-memory MongoDB');
// Perform database operations
await mongoose.disconnect();
await mongod.stop();
})();
Mockgoose is a library that provides a mock to mongoose by using an in-memory database. It is similar to mongodb-memory-server-core in that it allows for in-memory MongoDB instances, but it is specifically designed to work with Mongoose.
Mongodb-memory-server is a higher-level package that wraps around mongodb-memory-server-core and provides additional features and utilities. It is more user-friendly and includes more out-of-the-box functionality compared to mongodb-memory-server-core.
Mongo-unit is a library that provides utilities for unit testing with MongoDB. It allows you to start and stop in-memory MongoDB instances and load initial data. It is similar to mongodb-memory-server-core but includes additional utilities for unit testing.
Changelog
9.0.0 (2023-10-06)
resolveConfig: Default binary version is now "6.0.9"
DryMongoBinary: "legacyHomeCache" has been renamed to "homeCache" when using "DryMongoBinary" directly
MongoMemoryReplSet: ReplSet option "auth" can now not be a boolean anymore, use as a object instead
Authentication now is only created when "{ enable: true }" is given also "disable" has been removed
MongoBinaryDownload: aliases for ".binaryOpts.*" have been removed, use ".binaryOpts.option" instead
".cleanup(boolean)" is now no longer supported, use object options instead
".stop(boolean)" is now no longer supported, use object options instead
tsconfig: potentially breaking change upgrading "target" to "es2020" in tsconfig
Lowest supported NodeJS version is now 14.0
MongoBinaryDownloadUrl::translateArch: "ia32" ("i386" / "i686") are now unsupported by mongodb-memory-server
tsconfig: potentially breaking change upgrading "target" to "es2019" in tsconfig
MongoInstance::checkErrorInLine: potentially breaking change not removing ", terminating" from error
MongoBinaryDownloadUrl::translatePlatform: potentially breaking change removing "sunos" from translation
tsconfig: update "target" to "es2019" (df41101)
tsconfig: update "target" to "es2020" (ff20382)
Readme
Core package which contains main code. Used in all other packages.
FAQs
MongoDB Server for testing (core package, without autodownload). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.
The npm package mongodb-memory-server-core receives a total of 475,514 weekly downloads. As such, mongodb-memory-server-core popularity was classified as popular.
We found that mongodb-memory-server-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.