![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Built with testing MEAN applications in mind. Gives a developer a way to populate mongo database from different data sources; functions, files, directories of JSON files.
Built with testing MEAN applications in mind. Gives a developer a way to populate mongo databases from different data sources; functions, files, directories of JSON files. Also allows the developer to clean up the databases after the test.
Also open to anyone who wants to build this out with more cool things.
This is where you have a directory filled with JSON files that were created from a mongoexport
.
NOTE: make sure to use --jsonArray when exporting data from tables. Similar mongoexport --db PetShop --collection Food --out Food.json --jsonArray
mongoSeed.load("localhost",27017, "<name_of_database>", "<seed_directory>", "dir", function (err) {
//..do what ever you need
});
This is similar to the directory seed. You have a file with an object in it where each property is a collection name and the value is an array of documents for that collection. This also supports two different data formats. The MongoDB Extended JSON(EXTENDED) or the JSON recognized by the node mongodb driver(DRIVER).
{
"dataFormat": "<Type-of-json>",// supported types EXTENDED or DRIVER
"table_Name": [/*Each document as an individual object in the array*/]
/*...*/
"table_Name_n": [/*Each document as an individual object in the array*/]
}
mongoSeed.load("localhost",27017, "<name_of_database>", "<path_to_file>", "file", function (err) {
//..do what ever you need
});
So loading from a function means you have a node module somewhere that returns JSON in the same format the node mongodb driver accepts. This came about because I wanted to use some of the mongoDB client helpers to set up data sets.
module.exports = function(){
return {
"table_Name": [/*Each document as an individual object in the array*/]
/*...*/
"table_Name_n": [/*Each document as an individual object in the array*/]
};
};
mongoSeed.load("localhost",27017, "<name_of_database>", "<path_function_def>", "function", function (err) {
//..do what ever you need
});
COMING SOON
Self-explanatory. Back up a database that causes certain test cases load it in the test environment then tear it down. Well when this is added....
COMING SOON
Ability to load JSON from a REST endpoint or maybe a JSON file stored on an S3 Bucket.
Lets say you have the following directory structure:
├── seeds
│ └── functionSeed.js
└── test
└── generica.test.js
The file functionSeed.js might look like this:
module.exports = function(){
return {
"table_Name": [
{
"_id": new ObjectId(“some id here”), "Name": "Person"
}
]
};
};
The in the test file, lets say you are using mocha for testing:
var async = require('async'),
mongoSeed = require('mongo-seed');
describe("testing some functionality", function(){
var mongo = {
"host": "",
"port": "",
"db": ""
};
before(function (done) {
async.waterfall([
function (callback) {
mongoSeed.clear(mongo.host, mongo.port, mongo.db, function (err) {
callback(err);
});
},
function (callback) {
var seedPath = path.resolve(__dirname + "/../seeds/functionSeed.js");
mongoSeed.load(mongo.host, mongo.port, mongo.db, seedPath, "function", function (err) {
callback(err);
});
}
],
function (err, results) {
if(err) throw err;
done();
});
});
it("Do some testing here", function(done){
// test here
done();
});
});
Lets say you need to seed multiple databases for testing here is a quick example of how you might do that.
var async = require('async'),
mongoSeed = require('mongo-seed');
describe("testing some functionality", function(){
var mongo = {
"host": "",
"port": "",
"db": ""
};
var mongo2 = {
"host": "",
"port": "",
"db": ""
};
before(function (done) {
async.waterfall([
function (callback) {
mongoSeed.clear(mongo.host, mongo.port, mongo.db, function (err) {
callback(err);
});
},
function (callback) {
mongoSeed.clear(mongo2.host, mongo2.port, mongo2.db, function (err) {
callback(err);
});
},
function (callback) {
var seedPath = path.resolve(__dirname + "/../seeds/functionSeed.js");
mongoSeed.load(mongo.host, mongo.port, mongo.db, seedPath, "function", function (err) {
callback(err);
});
},
function (callback) {
var seedPath = path.resolve(__dirname + "/../seeds/functionSeed2.js");
mongoSeed.load(mongo2.host, mongo2.port, mongo2.db, seedPath, "function", function (err) {
callback(err);
});
}
],
function (err, results) {
if(err) throw err;
done();
});
});
it("Do some testing here", function(done){
// test here
done();
});
});
FAQs
Built with testing MEAN applications in mind. Gives a developer a way to populate mongo database from different data sources; functions, files, directories of JSON files.
The npm package mongo-seed receives a total of 0 weekly downloads. As such, mongo-seed popularity was classified as not popular.
We found that mongo-seed 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.