添加电影的时候报了一个错误,我有点懵逼,还请小伙伴看看,这到底是什么错
{ [CastError: Cast to ObjectId failed for value "" at path "_id" for model "Movie"]
message: 'Cast to ObjectId failed for value "" at path "_id" for model "Movie"',
name: 'CastError',
stringValue: '""',
kind: 'ObjectId',
value: '',
path: '_id',
reason: undefined,
model:
{ [Function: model]
hooks: Kareem { _pres: {}, _posts: {} },
base:
Mongoose {
connections: [Object],
models: [Object],
modelSchemas: [Object],
options: [Object] },
modelName: 'Movie',
model: [Function: model],
db:
NativeConnection {
base: [Object],
collections: [Object],
models: [Object],
config: [Object],
replica: false,
hosts: null,
host: null,
port: null,
user: null,
pass: null,
name: null,
options: null,
otherDbs: [],
_readyState: 0,
_closeCalled: false,
_hasOpened: false,
_listening: false },
discriminators: undefined,
fetch: [Function],
findById: [Function],
_events: { init: [Function], save: [Function] },
_eventsCount: 2,
schema:
Schema {
obj: [Object],
paths: [Object],
aliases: {},
subpaths: {},
virtuals: [Object],
singleNestedPaths: {},
nested: [Object],
inherits: {},
callQueue: [Object],
_indexes: [],
methods: {},
statics: [Object],
tree: [Object],
query: {},
childSchemas: [],
plugins: [Object],
s: [Object],
options: [Object],
'$globalPluginsApplied': true },
collection:
NativeCollection {
collection: null,
opts: [Object],
name: 'movies',
collectionName: 'movies',
conn: [Object],
queue: [],
buffer: true,
emitter: [Object] },
Query: { [Function] base: [Object] },
'$__insertMany': [Function],
insertMany: [Function] } }
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'save' of undefined
at D:\wabstrom\film\app.js:94:19
at D:\wabstrom\film\node_modules\mongoose\lib\query.js:2843:9
at tryCatcher (D:\wabstrom\film\node_modules\bluebird\js\main\util.js:26:23)
at Promise._settlePromiseFromHandler (D:\wabstrom\film\node_modules\bluebird\js\main\promise.js:507:31)
at Promise._settlePromiseAt (D:\wabstrom\film\node_modules\bluebird\js\main\promise.js:581:18)
at Promise._settlePromises (D:\wabstrom\film\node_modules\bluebird\js\main\promise.js:697:14)
at Async._drainQueue (D:\wabstrom\film\node_modules\bluebird\js\main\async.js:123:16)
at Async._drainQueues (D:\wabstrom\film\node_modules\bluebird\js\main\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (D:\wabstrom\film\node_modules\bluebird\js\main\async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)