【发布时间】:2016-09-12 21:05:12
【问题描述】:
将数据发布到 Meteor 的 MongoDB 集合的最佳方式是什么? 我最初尝试使用 Postman chrome 扩展、命令行工具(如 curl),但没有找到任何运气。
我使用的 curl 命令是:
curl -i -X POST -H "Content-Type: application/json" -d '{"hacker":"fromcurl","score":100}' http://localhost:3000/players
输出:
HTTP/1.1 200 OK
vary: Accept-Encoding
content-type: text/html; charset=utf-8
date: Tue, 17 May 2016 00:37:44 GMT
connection: keep-alive
transfer-encoding: chunked
<!DOCTYPE html>
<html>
PS : player 是集合/表名
【问题讨论】:
-
@pink612 您的应用程序是否需要有一个
REST接口,以便您可以从命令行执行此操作?如果没有,一般的答案是使用流星方法。 -
@DavidWeldon 感谢您的回复。我已将 simple:rest 包添加到我的流星应用程序中。仍然将数据发布到 mongo db 似乎不起作用。
标签: mongodb rest curl meteor postman