我正在使用 monger 进行查询,如下所示:
(let [uri mongo-uri
{:keys [conn db]} (mg/connect-via-uri mongo-uri-only)]
(defroutes myRoutes
(GET "/someroute" req
(let [user-id (:id (json/read-str (:body (get-user-info (:access_token (json/read-str (:body (get-authentication-response csrf-token req)) :key-fn keyword)))) :key-fn keyword)) ]
;; the query
(mc/find-one db "users" {:user-id user-id})
)))
mongo-uri 是:
"mongodb+srv://clojurewerkz/username:password@cluster0-ww5gh.mongodb.net/test?retryWrites=true&w=majority"
mongo-uri-only 是:
"mongodb+srv://cluster0-ww5gh.mongodb.net/test?retryWrites=true&w=majority"
但是在获取时出现以下错误/someroute
HTTP ERROR 500 com.mongodb.MongoQueryException: Query failed with error code 8000 and error message 'user is not allowed to do action [find] on [test.users]' on server cluster0-shard-00-01-ww5gh.mongodb.net:27017
我究竟做错了什么?