static void Main(string[] args)
|
{
|
var client = new MongoClient(new MongoClientSettings() { LinqProvider = Linq.LinqProvider.V3});
|
var db = client.GetDatabase("d");
|
var coll = db.GetCollection<Root>("c");
|
|
coll.InsertOne(new Root() { ForSelectMany = new[] { new WitDateTimeOffset { Date = DateTimeOffset.UtcNow} } });
|
|
var res = coll.AsQueryable()
|
.SelectMany(x => x.ForSelectMany)
|
.Select(y => new OutputWithMonth(y.Date.Month))
|
.ToList();
|
}
|
|
|
private class Root
|
{
|
public IEnumerable<WitDateTimeOffset> ForSelectMany { get; internal set; }
|
}
|
|
public class WitDateTimeOffset
|
{
|
public DateTimeOffset Date { get; set; }
|
}
|
|
private class OutputWithMonth
|
{
|
public int Month;
|
|
public OutputWithMonth(int month) => Month = month;
|
}
|