mongodb-odm icon indicating copy to clipboard operation
mongodb-odm copied to clipboard

Support GeoJSON and 2dsphere queries

Open jmikola opened this issue 11 years ago • 7 comments

Creating this from #530.

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

Todo items:

  • [x] Upgrade ODM to support doctrine/mongodb 1.1 (possibly another PR)
  • [ ] Add GeoJSON Type mappings
  • [ ] Tests for query builder integration

jmikola avatar Jul 11 '13 20:07 jmikola

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

alcaeus avatar Dec 22 '17 06:12 alcaeus

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.

jmikola avatar Jan 02 '18 15:01 jmikola

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.

alcaeus avatar Jan 04 '18 09:01 alcaeus

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.

stale[bot] avatar Feb 14 '19 12:02 stale[bot]

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

jmikola avatar Feb 14 '19 15:02 jmikola

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

alcaeus avatar Feb 15 '19 05:02 alcaeus

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.

jmikola avatar Feb 26 '19 19:02 jmikola