MongoDatabaseBase.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Threading;
  17. using System.Threading.Tasks;
  18. using MongoDB.Bson;
  19. namespace MongoDB.Driver
  20. {
  21. /// <summary>
  22. /// Base class for implementors of <see cref="IMongoDatabase" />.
  23. /// </summary>
  24. public abstract class MongoDatabaseBase : IMongoDatabase
  25. {
  26. // public properties
  27. /// <inheritdoc />
  28. public abstract IMongoClient Client { get; }
  29. /// <inheritdoc />
  30. public abstract DatabaseNamespace DatabaseNamespace { get; }
  31. /// <inheritdoc />
  32. public abstract MongoDatabaseSettings Settings { get; }
  33. // public methods
  34. /// <inheritdoc />
  35. public virtual void CreateCollection(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  36. {
  37. throw new NotImplementedException();
  38. }
  39. /// <inheritdoc />
  40. public virtual void CreateCollection(IClientSessionHandle session, string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  41. {
  42. throw new NotImplementedException();
  43. }
  44. /// <inheritdoc />
  45. public abstract Task CreateCollectionAsync(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  46. /// <inheritdoc />
  47. public virtual Task CreateCollectionAsync(IClientSessionHandle session, string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  48. {
  49. throw new NotImplementedException();
  50. }
  51. /// <inheritdoc />
  52. public virtual void CreateView<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  53. {
  54. throw new NotImplementedException();
  55. }
  56. /// <inheritdoc />
  57. public virtual void CreateView<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  58. {
  59. throw new NotImplementedException();
  60. }
  61. /// <inheritdoc />
  62. public virtual Task CreateViewAsync<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  63. {
  64. throw new NotImplementedException();
  65. }
  66. /// <inheritdoc />
  67. public virtual Task CreateViewAsync<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
  68. {
  69. throw new NotImplementedException();
  70. }
  71. /// <inheritdoc />
  72. public virtual void DropCollection(string name, CancellationToken cancellationToken = default(CancellationToken))
  73. {
  74. throw new NotImplementedException();
  75. }
  76. /// <inheritdoc />
  77. public virtual void DropCollection(IClientSessionHandle session, string name, CancellationToken cancellationToken = default(CancellationToken))
  78. {
  79. throw new NotImplementedException();
  80. }
  81. /// <inheritdoc />
  82. public abstract Task DropCollectionAsync(string name, CancellationToken cancellationToken = default(CancellationToken));
  83. /// <inheritdoc />
  84. public virtual Task DropCollectionAsync(IClientSessionHandle session, string name, CancellationToken cancellationToken = default(CancellationToken))
  85. {
  86. throw new NotImplementedException();
  87. }
  88. /// <inheritdoc />
  89. public abstract IMongoCollection<TDocument> GetCollection<TDocument>(string name, MongoCollectionSettings settings = null);
  90. /// <inheritdoc />
  91. public virtual IAsyncCursor<string> ListCollectionNames(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  92. {
  93. throw new NotImplementedException();
  94. }
  95. /// <inheritdoc />
  96. public virtual IAsyncCursor<string> ListCollectionNames(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  97. {
  98. throw new NotImplementedException();
  99. }
  100. /// <inheritdoc />
  101. public virtual Task<IAsyncCursor<string>> ListCollectionNamesAsync(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  102. {
  103. throw new NotImplementedException();
  104. }
  105. /// <inheritdoc />
  106. public virtual Task<IAsyncCursor<string>> ListCollectionNamesAsync(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  107. {
  108. throw new NotImplementedException();
  109. }
  110. /// <inheritdoc />
  111. public virtual IAsyncCursor<BsonDocument> ListCollections(ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  112. {
  113. throw new NotImplementedException();
  114. }
  115. /// <inheritdoc />
  116. public virtual IAsyncCursor<BsonDocument> ListCollections(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  117. {
  118. throw new NotImplementedException();
  119. }
  120. /// <inheritdoc />
  121. public abstract Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  122. /// <inheritdoc />
  123. public virtual Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  124. {
  125. throw new NotImplementedException();
  126. }
  127. /// <inheritdoc />
  128. public virtual void RenameCollection(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  129. {
  130. throw new NotImplementedException();
  131. }
  132. /// <inheritdoc />
  133. public virtual void RenameCollection(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  134. {
  135. throw new NotImplementedException();
  136. }
  137. /// <inheritdoc />
  138. public abstract Task RenameCollectionAsync(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken));
  139. /// <inheritdoc />
  140. public virtual Task RenameCollectionAsync(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  141. {
  142. throw new NotImplementedException();
  143. }
  144. /// <inheritdoc />
  145. public virtual TResult RunCommand<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken))
  146. {
  147. throw new NotImplementedException();
  148. }
  149. /// <inheritdoc />
  150. public virtual TResult RunCommand<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken))
  151. {
  152. throw new NotImplementedException();
  153. }
  154. /// <inheritdoc />
  155. public abstract Task<TResult> RunCommandAsync<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken));
  156. /// <inheritdoc />
  157. public virtual Task<TResult> RunCommandAsync<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default(CancellationToken))
  158. {
  159. throw new NotImplementedException();
  160. }
  161. /// <inheritdoc />
  162. public virtual IAsyncCursor<TResult> Watch<TResult>(
  163. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  164. ChangeStreamOptions options = null,
  165. CancellationToken cancellationToken = default(CancellationToken))
  166. {
  167. throw new NotImplementedException(); // implemented by subclasses
  168. }
  169. /// <inheritdoc />
  170. public virtual IAsyncCursor<TResult> Watch<TResult>(
  171. IClientSessionHandle session,
  172. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  173. ChangeStreamOptions options = null,
  174. CancellationToken cancellationToken = default(CancellationToken))
  175. {
  176. throw new NotImplementedException(); // implemented by subclasses
  177. }
  178. /// <inheritdoc />
  179. public virtual Task<IAsyncCursor<TResult>> WatchAsync<TResult>(
  180. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  181. ChangeStreamOptions options = null,
  182. CancellationToken cancellationToken = default(CancellationToken))
  183. {
  184. throw new NotImplementedException(); // implemented by subclasses
  185. }
  186. /// <inheritdoc />
  187. public virtual Task<IAsyncCursor<TResult>> WatchAsync<TResult>(
  188. IClientSessionHandle session,
  189. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  190. ChangeStreamOptions options = null,
  191. CancellationToken cancellationToken = default(CancellationToken))
  192. {
  193. throw new NotImplementedException(); // implemented by subclasses
  194. }
  195. /// <inheritdoc />
  196. public virtual IMongoDatabase WithReadConcern(ReadConcern readConcern)
  197. {
  198. throw new NotImplementedException();
  199. }
  200. /// <inheritdoc />
  201. public virtual IMongoDatabase WithReadPreference(ReadPreference readPreference)
  202. {
  203. throw new NotImplementedException();
  204. }
  205. /// <inheritdoc />
  206. public virtual IMongoDatabase WithWriteConcern(WriteConcern writeConcern)
  207. {
  208. throw new NotImplementedException();
  209. }
  210. }
  211. }