/// <summary> /// Get execution plan over current query definition to see how engine will execute query /// </summary> // TODO: Not sure if this should be implemented /*public BsonDocument GetPlan() * { * _query.ExplainPlan = true; * * using (var reader = _engine.Query(_collection, _query)) * { * return reader.Current.AsDocument; * } * }*/ #endregion #region Execute Single/First /// <summary> /// Returns the only document of resultset, and throw an exception if there not exactly one document in the sequence /// </summary> public Task <T> SingleAsync() { var tcs = new TaskCompletionSource <T>(); _liteDatabaseAsync.Enqueue(tcs, () => { tcs.SetResult(_wrappedQuery.Single()); }); return(tcs.Task); }
/// <summary> /// Get execution plan over current query definition to see how engine will execute query /// </summary> // TODO: Not sure if this should be implemented /*public BsonDocument GetPlan() * { * _query.ExplainPlan = true; * * using (var reader = _engine.Query(_collection, _query)) * { * return reader.Current.AsDocument; * } * }*/ #endregion #region Execute Single/First /// <summary> /// Returns the only document of resultset, and throw an exception if there not exactly one document in the sequence /// </summary> public Task <T> SingleAsync() { return(_liteDatabaseAsync.EnqueueAsync( () => _wrappedQuery.Single())); }