i've open account on mongolab (free sandbox account testing). have code that's running on local mongodb server , running fine without problems.
in mongolab i've created database , created user database , placed connection string gave me in application:
mongodb://<dbuser>:<dbpassword>@<my_id>.mlab.com:52408/<my_db>
i tried this:
mongodb://<dbuser>:<dbpassword>@<my_id>.mlab.com:52408/<my_db>?authmode=scram-sha1&rm.tcpnodelay=true
in .net code i'm connecting database:
mongoclient client = new mongoclient(my_connection_string); imongodatabase database = client.getdatabase("mytestdb"); _versionrulescollection = database.getcollection<versionrule>("versionrules"); _versiondetailscollection = database.getcollection<versiondetails>("versiondetails");
but when try this:
_versiondetailscollection.indexes.createoneasync(builders<versiondetails>.indexkeys.ascending(x => x.productname).ascending(y => y.devicetype).ascending(z => z.versionname))
i exception saying
system.aggregateexception: 1 or more errors occurred. ---> mongodb.driver.mongocommandexception: command createindexes failed: not authorized on mytestdb execute command { createindexes: "versiondetails", indexes: [ { key: { productname: 1, devicetype: 1, versionname: 1 }, name: "productname_1_devicetype_1_versionname_1" } ] }
even trying query got:
not authorized query on mytestdb .versiondetails
i don't see way set permission users on portal. database created dynamically in app. , i'm @ lost here.
what doing wrong (it works on local machine)?
Comments
Post a Comment