doctrine / mongodb-odm

The Official PHP MongoDB ORM/ODM
https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/
MIT License
1.09k stars 504 forks source link

Support creating time series collections #2533

Closed nicklaw5 closed 3 weeks ago

nicklaw5 commented 1 year ago

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

As far as I can tell, this ODM doesn't yet support creating time series collections.

It doesn't appear to me that it would be too difficult to implement this. Seems we'd need to add the timeseries option on Document::$collection like we already do for the capped, size and max collection options.

The end goal for my team and I would be to have the ability to create time series collections using the DoctrineMongoDBBundle schema:create command:

bin/console doctrine:mongodb:schema:create --collection
malarzm commented 1 year ago

Seems we'd need to add the timeseries option on Document::$collection like we already do for the capped, size and max collection options.

That'd be the way to go IMO. Possible it'll turn out that instead of array-based configs it'll be better to have dedicated CappedCollection and TimeSeriesCollection VOs :)

It doesn't appear to me that it would be too difficult to implement this.

Are you willing to give it a go?

bradroc commented 1 year ago

Are you willing to give it a go?

I'd be willing to make a stab at this @malarzm. Is there any preference on direction re: using the same Collection definition or having a separate decorator for TimeSeriesCollection?

malarzm commented 1 year ago

I'd be willing to make a stab at this @malarzm.

Awesome! Thank you 🎉

FWIW there's work started in a draft PR here: #2542

Is there any preference on direction re: using the same Collection definition or having a separate decorator for TimeSeriesCollection?

For now we've decided to follow in the footsteps of capped collection as it made sense, however I really like the idea of having #[Collection], #[CappedCollection] and #[TimeSeriesCollection]! That would clearly separate what setting goes where. If I'm not mistaken this can be done as a separate step though, so:

  1. Finish #2542 or open new one
  2. Have it merged
  3. Introduce new attributes/xml syntax in a BC manner, deprecate old properties
cyildirim commented 1 year ago

HI @bradroc, it would be great to collaborate on this. We need to rerun/fix/add some tests on the project. I've shared some progress on Symfony's new-doctrine-contributors slack channel. If you can join us there it would be great.

nicklaw5 commented 1 month ago

Seeing some progress on this in #2687

alcaeus commented 3 weeks ago

This feature has been implemented and will be released in 2.10.0!