2
我試圖將數據插入到MongoDB的3.4 GridFS的存儲通過一個彈簧啓動的應用程序啓用身份驗證,但我不斷收到此錯誤:MongoDB的GridFS的認證工作不
Query failed with error code 13 and error message 'not authorized on user to execute command { find: \"fs.files\", filter: { metadata.fieldname: \"someContent\" } }' on server ip:27017"
我創建了一個用戶與「超級用戶「這個權利:
use admin
db.createUser(
{
user: "admin",
pwd: "password",
roles:["root"]
})
我的春天開機application.properties是:
spring.data.mongodb.host=ip
spring.data.mongodb.port=27017
spring.data.mongodb.username=admin
spring.data.mongodb.password=password
spring.data.mongodb.database=user
spring.data.mongodb.authentication-database=admin
我已經嘗試過,沒有運氣的「老」的MongoDB角色:
db.createUser(
{
user: "admin",
pwd: "password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" },
{ role: "dbAdminAnyDatabase", db: "admin" },
{ role: "clusterAdmin", db: "admin" }
]
})
讀取和寫入其他(非GridFS的)數據庫完美的作品。 關於如何解決這個問題的任何想法?
這似乎是一個春季啓動配置問題......當使用「Robo 3T」時,我可以從fs.files和fs.chunks中讀取。 – VERGiL