             
             document = ["$push": [field: pushValue] as Document]
         }
+    }
+    
+    /// Converts the operator to a Primitive
+    public func makePrimitive() -> Primitive? {
+        return document
+    }
+    
+    public func encode(to encoder: Encoder) throws {
         try document.encode(to: encoder)
     }
 }

/// Modifiers that are available for use in array update operations.
///
/// - see: https://docs.mongodb.com/manual/reference/operator/update-array/
public enum ArrayUpdateOperator: Encodable {
    
    // These are primarly used within update operators and thus cannot be represented easily here.
//    case matchFirst(Primitive)
    
//    case matchAll(Primitive)
    
//    case matchFiltered(Primitive)
    
    /// The $addToSet operator adds a value to an array unless the value is already present, in which case $addToSet does nothing to that array.
    case addToSet(field: String, Primitive)
    

        case sortDescending(field: String?)
    }
    
    /// Converts the operator to a Document
    private var document: Document {
        let document: Document
        
        switch self {
        case .addToSet(let field, let value):
            document = ["$addToSet": [field: value] as Document]
        case .popFirst(let field):
