# \[SandboxUnhandledError\] db is not defined

**URL:** <https://community.auth0.com/t/sandboxunhandlederror-db-is-not-defined/8556>\
**Category:** Get Help\
**Tags:** not-working, save-users-to-db, custom-database\
**Created:** [October 24, 2017, 6:36am UTC](https://community.auth0.com/t/sandboxunhandlederror-db-is-not-defined/8556 "2017-10-24T06:36:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienfumanti](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@julienfumanti](https://community.auth0.com/u/julienfumanti)\
**Post date:** [October 24, 2017, 6:36am UTC](https://community.auth0.com/t/sandboxunhandlederror-db-is-not-defined/8556/1 "2017-10-24T06:36:19Z")

</div>

Hi,

I am trying to create a user from custom db (mongo db) → create user → try.

But when I fill in user and pwd ; I have this error [SandboxUnhandledError] db is not defined

With login it’s working.  
Could you please help me?

Thanks,

---

<div class="post-metadata">

**Author:** ![julienfumanti](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@julienfumanti](https://community.auth0.com/u/julienfumanti)\
**Post date:** [October 24, 2017, 6:37am UTC](https://community.auth0.com/t/sandboxunhandlederror-db-is-not-defined/8556/2 "2017-10-24T06:37:58Z")

</div>

Btw , here is my beginning of my code :

```
function create (user, callback) {
  mongo('mongodb://username:pwd@myurl/mydb', function (db) {
    
    var users = db.collection('users');
...

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/sandboxunhandlederror-db-is-not-defined/8556/3 "2018-03-02T05:57:06Z")

</div>


