https://github.com/ibebbs/cosmosselectmanyrepro
Reproduction of "SelectMany doesn't work after Select" issue (#91)
https://github.com/ibebbs/cosmosselectmanyrepro
Last synced: 13 days ago
JSON representation
Reproduction of "SelectMany doesn't work after Select" issue (#91)
- Host: GitHub
- URL: https://github.com/ibebbs/cosmosselectmanyrepro
- Owner: ibebbs
- Created: 2018-10-29T11:00:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-29T11:14:07.000Z (over 7 years ago)
- Last Synced: 2025-05-25T08:41:34.059Z (about 1 year ago)
- Language: C#
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CosmosSelectManyRepro
Reproduction of [SelectMany doesn't work after Select](https://github.com/Azure/azure-cosmosdb-dotnet/issues/91#issuecomment-432037836) issue.
# Environment
Nunit test (with VS Test adapter) which uses the [CosmosDB local emulator](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator)
# Issue
The query:
```
var query = _client
.CreateDocumentQuery(_collection.SelfLink)
.Select(container => container.Pupil)
.SelectMany(pupil => pupil.Classes
.Where(@class => @class.Id == CosmosDB101.Id)
.Select(@class => pupil));
```
Generates: `SELECT VALUE root["Pupil"] FROM root JOIN class IN root["Classes"] WHERE (class["Id"] = "501ffc8e-272d-4f26-bebb-f5ce8ce1c095")`
But should generate: `SELECT VALUE root["Pupil"] FROM root JOIN class IN root["Pupil"]["Classes"] WHERE (class["Id"] = "501ffc8e-272d-4f26-bebb-f5ce8ce1c095")`