Domanda


I'm trying to have a geo-pagination system. I refeer to this article Blog article from mongoDB
My problem is that I'm using doctrine MongoDB and i don't seem to find how to set minDistance field in Doctrine MongoDB My Mongo version is 2.4.8

È stato utile?

Soluzione

Support for this was not implemented in Doctrine MongoDB, but I've implemented it in PR #171, which is now in the 1.2.x-dev branch (we don't yet have a 1.2.0 release). You can look at the documentation blocks or unit tests in that PR for insight into how to use it, but I modeled it after maxDistance().

I should mention that in 1.1.x of Doctrine MongoDB, you didn't actually need the builder method available to inject the minDistance option into geoNear. If you look at this code in Query.php, you'll see that we merge options from the builder atop $options, which ultimately comes from Query's constructor. Keep this in mind should you need to pass options to other commands when there is not a pre-existing builder method.

Lastly, you mentioned that you're using MongoDB 2.4.8. Note that MongoDB 2.4.x does not support this option (for geoNear) or query operator (for $near and $nearSphere). It was implemented in SERVER-9395 (this commit) and first appeared in 2.5.1. You'll also find it in 2.6.0, of course.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top