anchor.diff:              | _ -> x.ConvertedType
   
   [<AutoOpen>]
  -module ActivePatterns =
  -
  -    let (|MapWithNull|_|) (map:Map<_,_>) =
  -        if map.Count = 2 then
  -            match Map.toList map with
  -            | [ (InferedTypeTag.Null, _); elem ]
  -            | [ elem; (InferedTypeTag.Null, _) ] -> Some elem
  -            | _ -> None
  -        else None
  +module private ActivePatterns =
  +
  +    let (|EmptyCollection|_|) = function
  +    | InferedType.Collection (_, EmptyMap InferedType.Top typ) -> Some typ
  +    | _ -> None
  +
  +    let (|SingletonCollection|_|) = function
  +    | InferedType.Collection (_, SingletonMap (_, (_, typ))) -> Some typ
  +    | _ -> None
  +
  +    let (|CollectionOfOptionals|_|) inferedType =
  +
  +        let (|MapWithNull|_|) (map:Map<_,_>) =
  +            if map.Count = 2 then
  +                match Map.toList map with
  +                | [ (InferedTypeTag.Null, _); elem ]
  +                | [ elem; (InferedTypeTag.Null, _) ] -> Some elem
  +                | _ -> None
  +            else None
  +
  +        match inferedType with
  +        | InferedType.Collection (_, MapWithNull (_, (_, typ))) -> Some typ
  +        | _ -> None
  +
   
   module BsonTypeBuilder =
   
  
positive.code: 
              objectTy
  
          | InferedType.Collection (_, SingletonMap (_, (_, typ)))
          | InferedType.Collection (_, EmptyMap InferedType.Top typ) ->
  
              let elementResult = generateBsonType ctx (*optionalityHandledByCaller*)false nameOverride typ
  
  
negative.code: 
              inferCollection elementResult.ConvertedType conv
  
          | CollectionOfOptionals typ ->
              let elementResult = generateBsonType ctx (*optionalityHandledByCaller*)false nameOverride typ
  
              let conv = fun (doc:Expr) ->
  