sto ottenendo errore "TypeError: Impossibile leggere la proprietà '_id' di indefinito" su una semplice richiesta post per salvare un documento per la collezione chiamata books
, mio carico si presenta così :TypeError: Impossibile leggere la proprietà '_id' undefined
{
"name": "practical view",
"author": "DN",
"location": "room 50"
}
E sto solo facendo il mio percorso in db.books.save()
in espresso. Dato che non sto passando l'id, dovrebbe funzionare idealmente, ma non in questo caso.
Di seguito si riporta la discarica di errore completo sto ottenendo sul mio server nodo:
C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\mongodb\lib\mongodb\mongo_client.js:411
throw err
^
TypeError: Cannot read property '_id' of undefined
at Collection.save (C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\mongodb\lib\mongodb\collection.js:393:15)
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\index.js:203:65
at apply (C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\thunky\index.js:16:28)
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\thunky\index.js:20:25
at Db.collection (C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\mongodb\lib\mongodb\db.js:488:44)
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\index.js:268:7
at apply (C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\thunky\index.js:16:28)
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\thunky\index.js:20:25
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\index.js:300:4
at C:\NodeProjects\ExpressTutorial\Library\node_modules\mongojs\node_modules\mongodb\lib\mongodb\mongo_client.js:408:11
31 Aug 00:14:30 - [nodemon] app crashed - waiting for file changes before starting...
inserisci il codice dove viene generato – soulcheck