node.js - 测试 Mongo 的数据生成器?

标签 node.js mongodb express

我正在尝试生成 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/

相关文章:

node.js - 如何通过 Twitter REST API 撤销 Twitter 授予应用程序的用户访问 token

node.js - 从 URL 获取图像到 S3

javascript - 访问删除请求 Mongoose 返回的结果

mongodb - 错误: Connection strategy not found MongoDB

mongodb - 通过迁移到 NoSQL 提高速度

javascript - 我如何通过 Protractor JS 从另一个 JS 调用外部 JS?

javascript - 从 atom Electron 中的 webview 访问 DOM

javascript - 将值传递给 Express 路由的 Node js 模块

regex - 为除以/api 开头的所有路由运行 express 中间件?

node.js - 为什么我的 node js express 应用程序无法保持事件状态?