我正在尝试生成 json 数据(种子数据),以便能够测试用 Express/MongoDb 编写的新应用程序。 我尝试了一些在线解决方案,例如:http://json-generator.com/但我想知道是否有一个 npm 包?
最佳答案
此过程称为 Database seeding .
Database seeding is the initial seeding of a database with data. This is often an automated process that is executed upon the initial setup of an application. The data can be dummy data or necessary data such as an initial administrator account.
您可以使用 npm 包 Faker生成随机数据并将数据播种到数据库中。
您可以使用 npm 包 node-migrate使用命令播种。
关于node.js - 测试 Mongo 的数据生成器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45904069/