EventSaucePHP / EventSauce

A pragmatic event sourcing library for PHP with a focus on developer experience.
https://eventsauce.io/
MIT License
817 stars 82 forks source link

Storing messages in MongoDB #208

Closed codedge closed 1 year ago

codedge commented 1 year ago

As I read through the documentation, I found the Doctrine (3) repository for message storages. This leads me to the assumption, that MongoDB can also be used for message storage (of course).

On the next page looking at the message repository

$messageRepository = new DoctrineUuidV4MessageRepository(
    connection: $doctrineDbalConnection,
    tableName: $tableName,
    serializer: $eventSauceMessageSerializer,
    tableSchema: new DefaultTableSchema(), // optional
    uuidEncoder: new BinaryUuidEncoder(), // optional
);

there is the argument tableName described - but MongoDB does not have tables, only collections.

So when using MongoDB does the tableName mean the collection name?

frankdejonge commented 1 year ago

Hi @codedge, the Doctrine connection is SQL only. For Doctrine MongoDB ODM you should create a different repository, specific to that dependency.

codedge commented 1 year ago

Thanks, just needed that as an explanation.