-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question - not bug #85
Comments
Are you trying to choose the database to authenticate the connection against instead of the default It is my understanding that the authentication occurs during Per the spec, you can choose both the database and auth-database like this: mongodb://user:pass@192.168.0.127:27017/test Or like this if the auth-database is not the same as the chosen database: mongodb://user:pass@192.168.0.127:27017/test?authSource=otherdb However, I've not checked if this second form works with this driver. |
What I'm trying to do is use Mongo with Jester for a REST API. I've got two issues.
There may be (probably is) a better way of doing this, so if you're aware of it, please advise. At-ing @dom96 in case he has some insight into this. Getting the following error when removing the Jester portion:
It looks like from the examples that using the URI method would auth on connection. Is this not correct? Building the following with import strformat
import jester
import nimongo/mongo
import nimongo/bson
var
user = "testUser"
pass = "testPass"
db = "test"
m: AsyncMongo = newAsyncMongoWithURI(fmt"mongodb://{user}:{pass}@192.168.0.127/{db}?authSource=admin")
coll = m["test"]["test"]
if not waitFor m.connect():
echo "Could not connect."
discard waitFor coll.insert(%*{"testKey": "test"})
routes:
get "/":
let res = waitFor coll.find(%*{}).all()
resp res
runForever() Jester's error message
|
The Jester part is fairly straightforward. The To pass JSON or XML in a RESTful fashion, here is an snippet of code I used for generating a RSS feed: routes:
get "/category/techpodcast/feed/":
var db = getNextConnection()
data["itemList"] = read_podCastItemList_recentFifteen(db)
resp Http200, rssPodcastXML(data), "application/rss+xml" My (This particular code used |
Describe the bug
A clear and concise description of what the bug is.
What am I doing wrong??
gives error:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: