mongodb_ecto icon indicating copy to clipboard operation
mongodb_ecto copied to clipboard

Add function for generating mongodb query from ecto query

Open ericmj opened this issue 10 years ago • 1 comments

Use case is for basing an aggregation query on an ecto query. I would be willing to work on this.

ericmj avatar Oct 21 '15 19:10 ericmj

This is a good idea. One of the problems I see with this is the fact that for some ecto queries we already generate aggregate pipelines (with max, min, count, etc).

What parts we normally extract from the Ecto.Query should we generate in this case? Only the MongoDB's query object or also the projection?

It shouldn't be that hard to do, the main part of the query is translated by NormalizedQuery.query/3, you can probably use that.

I have to admit, I'm a little bit ashamed of the code in normalized_query.ex, maybe this will nudge me to refactor it a little :smiley:

michalmuskala avatar Oct 22 '15 07:10 michalmuskala