[CSHARP-1315] Refactor LINQ infrastructure to enable support of new aggregation operators in server 3.2. Created: 14/Jun/15 Updated: 27/May/22 Resolved: 02/Sep/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.1 |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Kieren Johnstone | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Server Compat: | 3.1 | ||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||
| Description |
|
3.1.4 of the server brings the new $project-stage aggregate expression "$filter", allowing for filtering out elements of arrays which are sub-elements of documents. This works much like $elemMatch in find() - but in an aggregation pipeline. |
| Comments |
| Comment by Githook User [ 03/Sep/15 ] | ||||||||||||||||||||||
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}Message: | ||||||||||||||||||||||
| Comment by Githook User [ 02/Sep/15 ] | ||||||||||||||||||||||
|
Author: {u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}Message: | ||||||||||||||||||||||
| Comment by Craig Wilson [ 25/Jun/15 ] | ||||||||||||||||||||||
|
After looking at the Select().Where() problem, I think I'm going to have to do something drastic. It's just not something I thought of initially. I don't believe it will be difficult, just some refactoring. | ||||||||||||||||||||||
| Comment by Kieren Johnstone [ 25/Jun/15 ] | ||||||||||||||||||||||
|
Ah great! I haven't had a chance to do anything since putting the first PR together. Will be interesting to see what you did to implement. | ||||||||||||||||||||||
| Comment by Craig Wilson [ 23/Jun/15 ] | ||||||||||||||||||||||
|
So, I got the embedded chaining working. Not a lot of modification, just the understanding that previously chained methods that don't change the shape can simply use the same serialization info. So, Where().Select() works, and Where().Where().Select(). However, Select().Where() does not. I'll have to figure out what to do there, but for now, this is a good start. https://github.com/craiggwilson/mongo-csharp-driver/tree/csharp1315 Craig | ||||||||||||||||||||||
| Comment by Kieren Johnstone [ 16/Jun/15 ] | ||||||||||||||||||||||
|
Friday would be great, I'm in the UK so fairly early would be great if possible (3pm Friday here? = 9am CST). Perhaps you could pass me a Skype name/other details to os | ||||||||||||||||||||||
| Comment by Craig Wilson [ 15/Jun/15 ] | ||||||||||||||||||||||
|
Ok. Give me some time to think about it. Thursday or Friday? I'm in CST (Chicago, USA time zone). Let me know what times work for you or if another day is better. | ||||||||||||||||||||||
| Comment by Kieren Johnstone [ 15/Jun/15 ] | ||||||||||||||||||||||
|
Ah excellent, thanks. Basically this works fine with what I have:
This does not:
It's the "y.D" part in the Select not being 'covered' by existing code - the serialization info binder doesn't dig into it, and the projection transformer can't understand things like that without serialization info. A Skype or similar would be great, which timezone/times do you work in? Thanks again | ||||||||||||||||||||||
| Comment by Craig Wilson [ 15/Jun/15 ] | ||||||||||||||||||||||
|
Craig | ||||||||||||||||||||||
| Comment by Kieren Johnstone [ 15/Jun/15 ] | ||||||||||||||||||||||
|
I'm fairly confident I have this completed as an isolated feature - in a projection you can do a Where() and have it map to a $filter. However I was hoping to support a following Select() too. I'm still circling in on the solution - but it just doesn't look like the SerializationInfoBinder / AggregateLanguageTransformer are set up for chaining calls. There seem to be a few approaches possible:
It would seem that to 'flow' serialization info from the base SerializationExpression through the Where() ready for the Select() needs a change in approach. Still getting to grips with the role/persona of each class. Is there a quick pointer to give so I could run with this one? If not, I can prep a PR with just the $filter work. | ||||||||||||||||||||||
| Comment by Kieren Johnstone [ 14/Jun/15 ] | ||||||||||||||||||||||
|
I could really use this - I've started putting together some code to implement this which I hope will be suitable for a PR. I have it working successfully, with some tests too - except when chained with a Select(). I'm working on this actively, hope the code is written in the correct style - will keep this ticket updated. |