Entita.FATTURA fa = new Entita.FATTURA()
{
anno = fatt.Anno,
importotot = Convert.ToDouble(fatt.ImportoTot),
mese = fatt.Mese,
numfattura = fatt.NumFattura,
pagamento = fatt.Pagamento,
tipo = fatt.Tipo,
vocifattura = (from x in vocifattura
where x.FatturaId == fatt.Id
select new Entita.VOCI_FATTURA()
{
Id = ObjectId.GenerateNewId(),
descrizione = x.Descrizione,
importo = Convert.ToDouble(x.Importo)
}).ToList(),
clientefattura = elenco_cli.Where(x => x.partitaiva == cl.PartitaIVa).FirstOrDefault()
};
_mongodb.GetCollection<Entita.FATTURA>("fattura").InsertOne(fa);
when i try to insert the document fa, is saved correctly, the problem is that importotot are saved as string, so, if i try to make $sum of importotot return 0, becouse converted to string from InsertOne()
fatt.ImportoTot is decimal, i must set fa.ImportoTot also double & convert fatt.ImportoTot do double, like this is saved correctly to database
is bug of driver? i use mongo 3.2 & driver for c# 2.2.3.3