Add FindOnePipelineAsync method
This commit is contained in:
		| @@ -248,5 +248,16 @@ namespace Core.Blueprint.Mongo | ||||
|         { | ||||
|             return Task.Run(() => _collection.DeleteManyAsync(filterExpression)); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Executes an aggregation pipeline and returns the first document in the result asynchronously. | ||||
|         /// </summary> | ||||
|         /// <typeparam name="TOutput">The type of the output document you expect from the pipeline.</typeparam> | ||||
|         /// <param name="pipeline">The aggregation pipeline definition to execute.</param> | ||||
|         /// <returns>The first document from the aggregation result, or null if none found.</returns> | ||||
|         public virtual Task<TOutput> FindOnePipelineAsync<TOutput>(PipelineDefinition<TDocument, TOutput> pipeline) | ||||
|         { | ||||
|             return Task.Run(() => _collection.Aggregate(pipeline).FirstOrDefaultAsync()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Oscar Morales
					Oscar Morales