GithubHelp home page GithubHelp logo

Comments (1)

santigandolfo avatar santigandolfo commented on May 28, 2024

After reading the source code and mongo's docs (and with the help of ChatGPT) I've fould the following:

The reason why when I do the engine.find it fails is because the find method uses internally an aggregation pipeline where the find queries are set inside a $match stage. And because "You cannot use $near or $nearSphere in
$match queries as part of the aggregation pipeline" (from the MongoDB docs) then that's why the query fails (It would be nice if the OperationFailure error said this insead of the more generic "...are not allowed in this context").
The docs suggest to:
"
Use $geoNear stage instead of the $match stage.

Use $geoWithin query operator with $center or $centerSphere in the $match stage.
"

Is there a way to add the geoNear stage to the _prepare_find_pipeline method? I don't know what the best way to do it, if the queries should go in the queries parameter or in a separate one (or if there should be a different find method that allows this kind of queries).

from odmantic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.