Closed singhvikram704 closed 8 years ago
you have to create the db test first
with httpie client
http --json PUT http://localhost:8080/test
If you enabled security on RESTHeart you can pass the username and password with the -a option
http --json -a a:a PUT http://localhost:8080/test
i have already created db at my local by mongo shell. but still not able to connect.
Similarly, i am using mongolab for database. If i put its uri in restheart.yml then it connected it but when i hit for db, again it show error that db XXXX does not exits.
First your mongo-uri is wrong! Should be (note the colon : in place of the slash / before 27017).
mongo-uri: mongodb://127.0.0.1:27017
However I tried locally and this mistake should not prevent you to connect to your local mongodb (since 27017 is the default port).
1) How did you create the db using the mongodb shell? Note that in mongodb the db is actually created when some data is inserted in a collection so, for instance:
> use test
> db.coll.insert( {a:1} )
2) Have you tried to create the db as I suggested?
with PUT /test, RESTHeart actually creates the db.
3) which roles does the mongodb user have (I guess from your mongo-uri that you local mongodb is running without authentication enabled, but what about the mongolab)?
Note that you need it to have readWrite role on test to be able to create the db with RESTHeart?
I have already inserted lot of data in test db in user collection. but was not able to connect. I attached two clicks for it.
For mongolab(https://mongolab.com/) I created db->collection->document over there, Added uri in .yml, started restheart but same error giving as for local db.
Which RESTHeart and MongoDB versions?
Please report output of following request:
GET 127.0.0.1:8989/
FYI
I have created a test account on mongolab (mongodb version 3.0.7), tried it and it worked.
After db creation on mongolab, I had to create the db via RESTHeart first as mentioned before (PUT /db)
I reproduced the issue using mongodb 2.6
Going to fix it asap.......
Can you confirm you are using mongodb 2.x?
Hello ujibang,
I am also facing a similar issue. I am using restheart-1.1.0 and mongodb ver 2.6.11 from MongoLab.
I have given the following value to the mongo uri under restheart.yml:
mongodb://
Output for http://localhost:8080/pp can be found below:
{ _links: { self: { href: "/pp" } }, http status code: 404, http status description: "Not Found", message: "Db 'pp' does not exist" }
Please note that the database with the name
{ "_links": { "self": { "href": "/pp2" } }, "http status code": 403, "http status description": "Forbidden", "message": "The MongoDB user does not have enough permissions to execute this operation." }
Your response awaited to proceed further.
Thank you, Siddhartha Bhatia
I agree, its working fine with 3.0.7 as provide by mongolab.
But not working with 2.x
Thanx ujibang for you continue support.
Regards Vikram Singh
I fixed it in branch 1.1.x, all my tests succeed for version 2.6 as well
can you double check it (you need git, jdk1.8 and maven)?
to build it:
$ git clone https://github.com/SoftInstigate/restheart.git
Cloning into 'restheart'...
remote: Counting objects: 11141, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 11141 (delta 59), reused 0 (delta 0), pack-reused 10985
Receiving objects: 100% (11141/11141), 2.40 MiB | 520.00 KiB/s, done.
Resolving deltas: 100% (6528/6528), done.
Checking connectivity... done.
$ cd restheart
$ (master) git checkout 1.1.x
Branch 1.1.x set up to track remote branch 1.1.x from origin.
Switched to a new branch '1.1.x'
$ (1.1.x) mvn package
...
$ java -jar target/restheart.jar <conf-file-path-relative-to-jar-file>
if you confirm it is working in you use case, I'll release 1.1.1 asap
Hi ujibang
As per you instruction i configured api in eclipse and tested again but this time its giving error with 2.6 & 3.0.7:
com.mongodb.CommandFailureException: { "serverUsed" : "ds056815.mongolab.com:56815" , "ok" : 0.0 , "errmsg" : "not authorized on admin to execute command { fsync: 1 }" , "code" : 13} .
This message was coming with restheart versions <1.x
@singhvikram704 please pull and try again
I fixed it; however that log message is just about restheart not able to fsync data at shutdown.
I actually removed this step since it is not necessary (mongodb does it automatically at intervals) and requires a special permission on admin db (that you mongolab user does not have)
fixed in release 1.1.1
Working fine with latest release
Hi
I am using uri :- mongo-uri: mongodb://127.0.0.1/27017
Mongo is running on port 27017
Hitting url http://localhost:8080/test/products
But it always giving error message:- "message": "Db 'test' does not exist".
Could you please provide the solution for it.
Thanks