Closed lneoe closed 8 years ago
the primary key of new row was null when we create a new row like
null
var user = User(id: nil, name: "Vapor", email: "mongo@vapor.codes") try user.save()
the user.id will be null. skip the _id and the MongoKitten will fill this key automatically.
user.id
_id
MongoKitten
An Exception was raise when update
"exception" : "The _id field cannot be changed from {_id: ObjectId('5bc5f5570b6ecc7bf24d738b')} to {_id: \"5bc5f5570b6ecc7bf24d738b\"}.",
In most cases, we will not modify the primary key, so skip it too.
Awesome, thanks!
the primary key of new row was
null
when we create a new row likethe
user.id
will benull
. skip the_id
and theMongoKitten
will fill this key automatically.An Exception was raise when update
In most cases, we will not modify the primary key, so skip it too.