jovans2 opened a new issue #5166:
URL: https://github.com/apache/openwhisk/issues/5166
Hello,
I have the following setup: the "Standalone" OpenWhisk stack and locally
deployed MongoDB. I want to create actions that can read from database. Such as
this example:
`
import pymongo
def main(params):
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
mycol = mydb["users"]
username = params["username"]
password = params["password"]
myquery = {"username":username}
mydoc = mycol.find(myquery)
if(mydoc.count() == 0):
#username not found
return {"Fail":"Username not found"}
for x in mydoc:
if(x["password"] != password):
#password incorrect
return {"Fail":"Password is incorrect"}
#username and password match
return {"Success":username}
`
However, I tried with two approaches: Docker and zip.
wsk action create login-pymongo --docker
jovanvr97/python3action:pymongo-libs login.py
wsk action invoke login-pymongo --param username jovan --param password 123
--result
The output is:
{
"error": "The action did not return a dictionary."
}
Could you please tell me how should I proceed?
Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]