add new collections or mantain one collection



  • Exploring the source code of nodebb I noticed how mongodb uses only one collection ('objects') for each document. I have already read the reason for this choice, (it was decided to start with another database).
    But i would like to create a payment plugin that uses a different collection. Is it ok or is it better to follow the default setting?



  • If you decide to use a separate collection you won't be able to use the built in db.* methods since they all write to the objects collection. The db object exposes the underlying database client in db.client so you can use that to directly write to mongodb and use a separate collection.

    Keep in mind if you do this your plugin won't work on nodebb forums that are using redis or psql. db.setObject does something different on all 3 databases.



  • Thank you for the explanation. I will probably use a third-party database (firebase) for payments.
    Using firebase, different operations can be done on the client side, without disturbing the main server. I think this is very useful for a smoother user experience.


Log in to reply
 

Suggested Topics

  • 17
  • 4
  • 72
  • 6
  • 1
| |