I'm trying to use an azure function to upload data to a mongodb but I get an error saying "The type or namespace name 'MongoDB' could not be found (are you missing a using directive or an assembly reference?)". I have a function.proj file that has refs to the MongoDB.Driver package but that doesn't seem to be working. I tried using the #r sytax to import the package but thats not working either. I'm using version 3 of the azure funtion runtime. Can anybody point me in the right direction?
Contents of the function.proj file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver.Core" Version="2.11.3" />
<PackageReference Include="MongoDB.Driver" Version="2.11.3" />
<PackageReference Include="MongoDB.Bson" Version="2.11.3" />
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</ItemGroup>
Using directives
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using MongoDB.Driver;
using MongoDB.Bson;