Authenticating for ace db

Hi,

I’m trying to delete a device from the mongodb and I can’t authenticate against the ace DB. When I use the unifi user I invariably get

MongoServerError[AuthenticationFailed]: Authentication failed.

I connect into the container via podman exec -it unifi-db bash and run

mongosh --username "unifi" --password --authenticationDatabase admin

then

use ace

and when I try to delete the device with

db.device.remove({"mac":"xx:yy:zz:aa:bb:dd"})

I get

MongoServerError[Unauthorized]: not authorized on ace to execute command { delete: "device", deletes: [ { q: { mac: "xx:yy:zz:aa:bb:cc" }, limit: 0 } ], ordered: true, lsid: { id: UUID("< redacted>") }, $db: "ace" }

Question: what user do I have to use to authenticate against the ace DB to be able to remove the device from the DB (the root user used to setup the db doesn’t work, either - not sure if that one is even around after the initial setup)?

Okay, found out that I can do it with the root user.

use admin
db.auth("root", *REDACTED*)
use ace
ace> db.device.remove({ "mac": "xx:yy:zz:aa:bb:cc" } )
DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.
{ acknowledged: true, deletedCount: 0 }
ace> db.device.deleteOne({ "mac": "xx:yy:zz:aa:bb:cc" } )
{ acknowledged: true, deletedCount: 0 }

as a note for future reference (and future readers) mongodb isn’t our container, we support our containers only. With that said, mongodb is a database like most and has documentation for how to do pretty much everything, as you clearly found.

We’re glad you solved your issue.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.