Hi,
I have that query:
IEnumerable<EFeatureType> featureTypeIds = enumerable values // EFeatureType is enumerable
var query = DbGeneralContext.FeatureTypes.AsQueryable(new AggregateOptions { AllowDiskUse = true })
.Where(a => featureTypeIds.Contains(a.FeatureTypeId))
.GroupJoin(DbGeneralContext.FeatureLicenses,
ft => ft.Id,
fl => fl.FeatureTypeId,
(ft, fl) => new { FT = ft, FL = fl })
.SelectMany(a => a.FL,
(a, fl) =>
new
{
fl.AccountId,
fl.FeatureTypeId
})
.GroupJoin(DbGeneralContext.Accounts,
f => f.AccountId,
acc => acc.Id,
(f, acc) => new { f, acc })
.SelectMany(f => f.acc, (f, acc) => new
{
accountId = acc.Id,
accountName = acc.Name
})
.Select(r =>
new RepAccountReferenceModelDal
{
AccountId = r.accountId,
AccountName = r.accountName
});
try
{
List<RepAccountReferenceModelDal> res = await query.ToListAsync();
}
catch (Exception ex)
{
// hadle exception
}
Explaine:
DbGeneralContext.FeatureTypes is IMongoCollection<FeatureTypeDal>
DbGeneralContext.FeatureLicenses is IMongoCollection<FeatureLicenseDal>
DbGeneralContext.Accounts is IMongoCollection<AccountDal>
FeatureTypeDal has a field: public EFeatureType FeatureTypeId { get; set; } // which is enum
under driver 2.18.0 the query runs well
under version 2.21.0.0 the following exception occur:
MongoDB.Driver.MongoCommandException: Command aggregate failed: PlanExecutor error during aggregation :: caused by :: Used too much memory for a single array. Memory limit: 104857600 bytes. The array contains 389 elements and is of size 104611825 bytes. The element being added has size 268925 bytes..
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.<ExecuteAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Servers.Server.ServerChannel.<ExecuteProtocolAsync>d__20`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor.<ExecuteAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Operations.ReadCommandOperation`1.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Operations.AggregateOperation`1.<ExecuteAsync>d__65.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Operations.AggregateOperation`1.<ExecuteAsync>d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.OperationExecutor.<ExecuteReadOperationAsync>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.MongoCollectionImpl`1.<ExecuteReadOperationAsync>d__101`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.MongoCollectionImpl`1.<AggregateAsync>d__25`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.MongoCollectionImpl`1.<UsingImplicitSessionAsync>d__109`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToExecutableQueryTranslators.ExecutableQuery`3.<ExecuteAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.IAsyncCursorSourceExtensions.<ToListAsync>d__16`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at VoyantWebCloud.DataAccess.Mongo.Reg.IO.FeatureLicenseDalIo.<GetAccountIdsByFeatureLicenseTypesAsync>d__84.MoveNext() in D:\Repos\apps-quentry-services\Data\VoyantWebCloud.DataAccess.Mongo.Reg\IO\FeatureLicenseDalIo.cs:line 715