File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -51,18 +51,15 @@ public MongoQuery(MongoDatabase database, string collection)
51
51
/// </summary>
52
52
public MongoQuery AppendParameter ( string field , string modifier , object value ) {
53
53
54
- //make sure there is a field available
55
- if ( ! ( this . _Parameters [ field ] is BsonDocument ) ) {
56
- this . _Parameters [ field ] = new BsonDocument ( ) ;
54
+ //if using a modifier, set this as a document
55
+ if ( modifier is string ) {
56
+ BsonDocument parameters = new BsonDocument ( ) ;
57
+ parameters [ modifier ] = value ;
58
+ this . _Parameters [ field ] = parameters ;
57
59
}
58
-
59
- //if there isn't a modifier, just set it as the value
60
- if ( modifier == null ) {
61
- this . _Parameters [ field ] = value ;
62
- }
63
- //otherwise, set the modifier key and value inside of the document
60
+ //otherwise, just assign the value
64
61
else {
65
- ( this . _Parameters [ field ] as BsonDocument ) [ modifier ] = value ;
62
+ this . _Parameters [ field ] = value ;
66
63
}
67
64
68
65
//return the query to use
You can’t perform that action at this time.
0 commit comments