我在Mac/OSX本地安装了Parse-Server和Parse-Server Dashboard以及Mongodb-runner。
一切工作正常,除了当我关闭Mongodb-runner。当我使用mongodb-runner stop
关闭mongodb-runner,然后再次启动所有进程......之前保存的数据都不能被Parse-Server Dashboard查看。
如果我尝试使用这样的请求检索数据…响应是"Object not found"
$ curl -X GET
-H "X-Parse-Application-Id: APPLICATION_ID"
http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK
如果我关闭Dashboard和Parse,然后重新启动它们(不关闭mongoldb-runner),一切都很好,我可以查看数据。
mongodb-runner用于端到端测试,并在停止它时刷新保存的数据。
你应该配置mongodb,如果你想持久化你的数据或使用云提供商,如mlab.com,所以它也将与你的部署工作。
我查看了源代码,实际上可以告诉mongodb-runner不要在每次运行时通过环境变量清除DB:
MONGODB_PURGE=false mongodb-runner start
我在windows上,所以我喜欢使用cross_env
:
...
"prestart": "cross-env MONGODB_PURGE=false mongodb-runner start",
"start": "nodemon -w src/**/*.ts --exec ts-node ./src/main.ts",
"poststart": "mongodb-runner stop",
...