'How do i apply Mongodb database and inside collections in multiple node.js applications

Good Day I have two nodes.js apps and they connect to the same database. I created a user model and here I save the new user in the first app.

ex.

const User = mongoose.model ('users', mongoose.Scheme ({...}))

User(...).save()

User.find()

However, the second app lacks const User. How should I apply user collection in the second app?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source