Yes i’m sure.
If that weren’t the case, it should give me an error or create a new collection with the value, I believe.
I have another function that reads data with a GET request and works correctly, so the connection to the database and the selection of the collection are correct.
This is the get funciont:
const client = await clientPromise;
const db = client.db(“expManager”);
const cdcs = await db
.collection(“cdc”)
.find({})
.sort({ metacritic: -1 })
.toArray();
return Response.json(cdcs)
and this is the post function:
const client = await clientPromise;
const db = client.db(‘expManger’);
const collection = db.collection(‘cdc’);
const stringa = {"description": "prova testo fisso"};
const jsontext = JSON.parse(stringa);
console.log(jsontext);
const result = await collection.insertOne(jsontext);