-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for aggregation event hooks #1057
Comments
Looks like #1025 I'm working on this problem |
Thank you for being so helpful. I've attempted to use the approach you've linked to, but I'm still having the same problem. You can see the simplified and revised approach below: MONGO_HOST="mongo"
MONGO_PORT=27017
MONGO_DBNAME="history"
ALLOW_UNKNOWN=True
PAGINATION_LIMIT=100
PAGINATION_DEFAULT=100
SCHEMA_ENDPOINT="first"
X_DOMAINS='*'
DOMAIN = {
'mapped': {
'allowed_filters' : ['*'],
'sorting': True,
'resource_methods': ['GET', 'POST'],
}
}
first = {
'datasource': {
'source': 'mapped',
'aggregation': {
'pipeline': [
{"$match": "$where$"}
]
}
}
} the endpoint I'm hitting is: At this point I'm just wanting to see that using aggregation can select anything at all from the database, but I'm having the same problem. Is this a configuration problem? Would you be able to point out where my misunderstanding is, or direct me to more comprehensive examples than are provided in the docs? |
This is how the aggregation work:
|
@Amedeo91 That really doesn't clarify anything for me. Would you be able to give a corrected example of aggregation configured correctly using my example? |
That is the thing: I am not sure that Eve is able to parse dictionary to create an entire step of the aggregation pipeline!! |
The solution can be additional
Is it relevant issue? Need some help? |
Event hooks for aggregation sounds great. How can I find out if this is in the roadmap? |
I just merged this feature to master. |
Thanks Nicola! Would you recommend using the development version in a new yet-to-be released project? I am tempted to use it just for this feature, but I might have a workaround for the stable version as well. PS. My untested workaround is to use a pass a match criteria to the aggregate function and require the web application pass the filter criteria (user ID) as an aggregate query parameter. I can use the pre-request event hook to ensure that the user ID provided matches the user ID of the current user. A little dirty, but it should work. |
A lot of people are using the development branch, I'd say it is (hopefully) stable enough. Also, I plan on releasing v0.8 next month. |
I switched over to the dev branch. I am able to use the new pre-aggregate event hooks. Looks great, thank you! I was also trying to understand your commit for this change. It looks very neat. Just two lines of code to enable the aggregate hook mechanism, but good amount of tests and documentation. Very well crafted. |
I'm attempting to set up an aggregation endpoint that would select the first point from every day within the location.
An example of a document:
I set up my settings.py like so:
But testing in the browser retrieves no results. example:
http://localhost:5000/first?aggregate={%22$lat%22:0,%22$lng%22:0%22$radius%22:12}
in the browser gives:What am I doing wrong? (Also Doesn't it seem odd you can only have one aggregation for the entire application as per the SCHEMA_ENDPOINT parameter?)
The text was updated successfully, but these errors were encountered: