vulcan-npm icon indicating copy to clipboard operation
vulcan-npm copied to clipboard

Update Next to use Mongo selector instead of Mongoose

Open eric-burel opened this issue 3 years ago • 1 comments

  • [ ] Create a single Mongo Client instance and expose it somewhere
  • [ ] Pass this Mongo client whenever you create a connector
  • [ ] Improve "filterFunction" to support both Mongo and Mongoose via a generic type? A Mongo connector was created in https://github.com/VulcanJS/vulcan-npm/pull/129 but types are not yet perfect
  • [ ] Duplicate tests created for mongooseConnector for mongoConnector

Contrary to Mongoose, Mongo node driver do not provide a global object. You have to create your own global client, that you can pass around to Vulcan, and connect it as usual in the "connectToAppDb" middleware everytime a serverless function is called (if its not yet connected of course).

eric-burel avatar Jun 23 '22 16:06 eric-burel

This might be a bad idea in the end, Mongoose model system is way easier to use than Mongo driver, which forces you to wait for the db to be connected to access models, thus leading to a lot of value/context passing and inability to use the normal "import/export" system to access models.

eric-burel avatar Sep 01 '22 09:09 eric-burel