-
Notifications
You must be signed in to change notification settings - Fork 92
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 tag parameter to tomatoes method #296
Comments
I use tomatoes for tracking hours worked for each client. I want to get number of hours (number of tomatoes/2) for each client for a specific time period. I have tags for each client. |
There's a composite index on the Any volunteer? cc @bugant @dalpo See also #168. |
@potomak would you do it with a map/reduce on mongodb? |
@bugant I don't think you need a map/reduce, I think you can just run a query that |
Ah didn't get it should only return a count, I was thinking about a filtered list (index) |
I think in either case you don't need map/reduce, but you can just run a query. query = Tomato.where(user_id: user_id).where(:created_at.gt => created_at).where(:tags.in => tags) Note: I'm not sure if that query will work, I didn't try it. tomatoes_count = query.count Reference: https://docs.mongodb.com/mongoid/6.4/tutorials/mongoid-queries/ |
Hmm, which kind of field is |
I wanted to get a number of tomatoes for the specified period of time and with a specified list of tags (actually, only one tag, but I think it would be nice to be possible to filter out for multiple number of tags in one request).
It would be nice to have one more filter parameter as tag in tomatoes method.
The text was updated successfully, but these errors were encountered: