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 GeoJSON and 2dsphere queries #631

Open jmikola opened 11 years ago

jmikola commented 11 years ago

Creating this from #530.

doctrine/mongodb 1.1 supports GeoJSON and 2dsphere queries as of https://github.com/doctrine/mongodb/pull/109.

Todo items:

alcaeus commented 6 years ago

@jmikola is this still relevant? Do we want to add type mappings for GeoJSON in 2.x?

jmikola commented 6 years ago

I have no recollection of any user ever requesting this, so I wouldn't prioritize it.

Side note: I do have plans to upgrade GeoJSON with support for the new BSON interfaces in ext-mongodb, which would allow the driver to handle the BSON conversion of those classes on its own. I also intend to update the namespace to Jmikola\GeoJSON (instead of global GeoJSON) in what would have to be a major version bump.

Does ODM 2.0 include any of the GeoJSON support that was previously in Doctrine MongoDB? If so, I can work on this sooner than later.

alcaeus commented 6 years ago

Does ODM 2.0 include any of the GeoJSON support that was previously in Doctrine MongoDB?

Yes, I've included this when moving all the logic from doctrine/mongodb to ODM.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

jmikola commented 5 years ago

Removing the stale label, as I think this is still worthwhile.

alcaeus commented 5 years ago

I added it to the roadmap for 2.1. Should be a nice little improvement along with some aggregation changes.

jmikola commented 5 years ago

Recap: @alcaeus suggested creating a GeoJSON 1.1 version that aliases the new class names as a forward-compatibility layer for proper renames in 2.0. See: https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf

ODM 2.0 can then require GeoJSON 1.0 or 1.1 and we can safely keep the current code with maual jsonSerialize() unwrapping as-is. If ODM 2.1+ then decides to introduce GeoJSON type mappings, we could then update the requirement to GeoJSON 2.0.