-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Feature Request
-
None
For example,
Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
class Widget { [BsonElement("x")] public int X { get; set; } [BsonElement("y")] public int Y { get; set; } [BsonElement("name")] public string Name { get; set; } }
We can create the ProjectionDefinition like this:
Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
var projection = Builders<Widget>.Projection<Widget>.Expression(x => new { X = x.X, Y = x.Y });
How about we want to use the expression to exclude a memeber/field?
Can we support something like this:
Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
var projection = Builders<Widget>.Projection<Widget>.Expression(x => new { Name = null });
Basically in the expression, if the right-hand operand is default(T), we treat it as excluded field/member.
Is that possible?