# Authentication failed / Your database looks empty ! (mongoDB)

**URL:** <https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005>\
**Category:** Help me!\
**Created:** [January 12, 2022, 3:56pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005 "2022-01-12T15:56:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)\
**Post date:** [January 12, 2022, 3:56pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/1 "2022-01-12T15:56:01Z")

</div>

Hello there, i don’t understand why i can’t connect to my DB.  
So i’ve got this database :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/b/b99e87ca368c583fc4d33a9d5bdc3f8f806b9584.png)

Also opened in compass :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/e/e83f5af0b6c4251f5fbe08935eb03adf35bbb519.png)

I tried putting my DB user’s credentials here :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/3/32a2a52a619e3ea0d609a062866717baae3cf439.png)

in mongo’s interface i have the user declared but i get this error…

> MongoError: Authentication failed.

if i put no credential i’m getting this instead :

> √ Connecting to your database  
> × Your database looks empty! Please create some collections before running the command.

Am i wrong when i put the DB name in the forest interface ?

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [January 12, 2022, 4:17pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/2 "2022-01-12T16:17:34Z")

</div>

Hello @bilboramix ! Welcome to our community. 🎊

We clearly display a weird error message. Sorry for the inconvenience.

Can you open the **Show advanced** section, you will find the **SRV** advanced option that can help with authentication.

Let me know if it helps. 🙏

Kind regards,  
Morgan

---

<div class="post-metadata">

**Author:** ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)\
**Post date:** [January 12, 2022, 4:31pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/3 "2022-01-12T16:31:06Z")

</div>

It’s weird, i used forest admin for another project few weeks ago and it worked fine. 🤔  
I’m not sure as this is the second time i’m doing it, maybe i did something wrong in mongo’s interface ?

With SRV putted on, i get this error :

> × MongoParseError: URI does not have hostname, domain name and tld

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [January 12, 2022, 4:37pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/4 "2022-01-12T16:37:26Z")

</div>

> [@bilboramix](#):
>
> It’s weird, i used forest admin for another project few weeks ago and it worked fine. 🤔

Was it with the same database ?

We might have another approach here:

- Are you using an atlas cluster to host your database ?
- Have you whitelisted your IP to be able to connect to the atlas cluster ?

Kind regards,  
Morgan

---

<div class="post-metadata">

**Author:** ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)\
**Post date:** [January 12, 2022, 4:42pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/5 "2022-01-12T16:42:21Z")

</div>

No, this is a new cluster, and new DB, i wanted to re-make a setup on my own, i was with my teacher for the first one 😇

So yes, i’m on mongo DB atlas and i’ve whitelisted all IP’s :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/d99ed15db25f4f450ef57c3ab2fbf993bdfcb160.png)

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 12, 2022, 4:44pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/6 "2022-01-12T16:44:27Z")

</div>

Hey @bilboramix 👋

Instead of `localhost`, you should be using the cluster URL (Should be visible in Atlas). Don’t forget to check the `Use SRV` option, and it should be good 👍

Let me know if that helps

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [January 12, 2022, 4:53pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/7 "2022-01-12T16:53:25Z")

</div>

Hey,  
The cluster host looks like this: `cluster0.x4fti.mongodb.net`. You can find it in `Connect > Connect your application > section 2`

---

<div class="post-metadata">

**Author:** ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)\
**Post date:** [January 12, 2022, 4:56pm UTC](https://community.forestadmin.com/t/authentication-failed-your-database-looks-empty-mongodb/4005/8 "2022-01-12T16:56:51Z")

</div>

Thank you all, it worked with the cluster url in host field (`clustertest.v39cx.mongodb.net`) and SRV putted on.

![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/b/b070c29a667480c96db36dfd747e3375e2fcaa74.png)

PS : it’s an issue about my course as they’re showing this :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/8/897eebf85bd98aebabf061a9eeab57228ada01f9.png)
