简体   繁体   English

Restheart:mongodb thgourh http获取返回404

[英]Restheart: mongodb thgourh http get returns 404

I have managed to access a static url but when it comes to accessing an existing collection in mongodb (2.6) through a browser (eg, http://0.0.0.0:8080/test/test ) it returns a 404. Anybody knows if I have to add anything to the default configuration.yml to activate mongo access? 我已经设法访问了静态网址,但是当涉及通过浏览器(例如http://0.0.0.0:8080/test/test )访问mongodb(2.6)中的现有集合时,它返回404。任何人都知道是否我必须将任何内容添加到默认的configuration.yml中才能激活mongo访问吗?

Thanks for help!! 感谢帮助!!

First make sure it is RESTHeart responding you request: if it is running on your pc, try 127.0.0.1:8080/test/test (not 0.0.0.0) 首先确保它是RESTHeart响应您的请求:如果它正在您的PC上运行,请尝试127.0.0.1:8080/test/test(不是0.0.0.0)

Also note that in case of 404, you should get a hal+json document with a "message" property (with somenthing like "the db test does bot exist"). 还要注意,在404的情况下,您应该获得带有“ message”属性的hal + json文档(诸如“ db test bot确实存在”之类的东西)。

If it is restheart, then either the db "test" or the collection "test/test" does not exist an you have to create them first. 如果是Restheart,则数据库“ test”或集合“ test / test”都不存在,您必须首先创建它们。

If restheart coudn't connect with mongodb you would get "400 Internal Server Error" response code. 如果restheart无法与mongodb连接,您将收到“ 400 Internal Server Error”响应代码。

Finally I managed to find what the problem was by myself. 最终,我自己找到了问题所在。 I post the answer in case it's helpful for somebody else. 如果有帮助,我会发布答案。 Thanks Andrea for the help in any case :) 无论如何,都要感谢Andrea的帮助:)

In the static-resources-mounts I had "where: /", which seemed to collide with the mongo-mounts default own "where: /". 在static-resources-mounts中,我有“ where:/”,这似乎与mongo-mounts默认的“ where:/”相冲突。 By changing either where value the access to mongodb retrieves a correct hal+json. 通过更改其中任一值,对mongodb的访问将检索正确的hal + json。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM