@@ -85,6 +85,36 @@ public static CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument valu
8585 {
8686 return new CollectionOptionsBuilder ( ) . SetStorageEngineOptions ( value ) ;
8787 }
88+
89+ /// <summary>
90+ /// Sets the validation action.
91+ /// </summary>
92+ /// <param name="validationAction">The validation action.</param>
93+ /// <returns>The builder (so method calls can be chained).</returns>
94+ public static CollectionOptionsBuilder SetValidationAction ( DocumentValidationAction validationAction )
95+ {
96+ return new CollectionOptionsBuilder ( ) . SetValidationAction ( validationAction ) ;
97+ }
98+
99+ /// <summary>
100+ /// Sets the validation level.
101+ /// </summary>
102+ /// <param name="validationLevel">The validation level.</param>
103+ /// <returns>The builder (so method calls can be chained).</returns>
104+ public static CollectionOptionsBuilder SetValidationLevel ( DocumentValidationLevel validationLevel )
105+ {
106+ return new CollectionOptionsBuilder ( ) . SetValidationLevel ( validationLevel ) ;
107+ }
108+
109+ /// <summary>
110+ /// Sets the validator.
111+ /// </summary>
112+ /// <param name="validator">The validator.</param>
113+ /// <returns>The builder (so method calls can be chained).</returns>
114+ public static CollectionOptionsBuilder SetValidator ( IMongoQuery validator )
115+ {
116+ return new CollectionOptionsBuilder ( ) . SetValidator ( validator ) ;
117+ }
88118 }
89119
90120 /// <summary>
@@ -161,6 +191,39 @@ public CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument value)
161191 return this ;
162192 }
163193
194+ /// <summary>
195+ /// Sets the validation action.
196+ /// </summary>
197+ /// <param name="validationAction">The validation action.</param>
198+ /// <returns>The builder (so method calls can be chained).</returns>
199+ public CollectionOptionsBuilder SetValidationAction ( DocumentValidationAction validationAction )
200+ {
201+ _document [ "validationAction" ] = validationAction . ToString ( ) . ToLowerInvariant ( ) ;
202+ return this ;
203+ }
204+
205+ /// <summary>
206+ /// Sets the validation level.
207+ /// </summary>
208+ /// <param name="validationLevel">The validation level.</param>
209+ /// <returns>The builder (so method calls can be chained).</returns>
210+ public CollectionOptionsBuilder SetValidationLevel ( DocumentValidationLevel validationLevel )
211+ {
212+ _document [ "validationLevel" ] = validationLevel . ToString ( ) . ToLowerInvariant ( ) ;
213+ return this ;
214+ }
215+
216+ /// <summary>
217+ /// Sets the validator.
218+ /// </summary>
219+ /// <param name="validator">The validator.</param>
220+ /// <returns>The builder (so method calls can be chained).</returns>
221+ public CollectionOptionsBuilder SetValidator ( IMongoQuery validator )
222+ {
223+ _document [ "validator" ] = validator . ToBsonDocument ( ) ;
224+ return this ;
225+ }
226+
164227 /// <summary>
165228 /// Returns the result of the builder as a BsonDocument.
166229 /// </summary>
0 commit comments