Closed firstpersoncode closed 5 years ago
alright, my app crashed because I tried autopopulate field with type String..
{
"message": "Cast to ObjectId failed for value \"Page-wMnot7nkUXFsujTtkSrtO19p\" at path \"_id\" for model \"Page\"",
"name": "CastError",
"stringValue": "\"Page-wMnot7nkUXFsujTtkSrtO19p\"",
"kind": "ObjectId",
"value": "Page-wMnot7nkUXFsujTtkSrtO19p",
"path": "_id"
},
You can set autopopulate on a string, but remember that both the local field and foreign field must be strings. In your case, you're setting autopopulate on a string, but the foreign models IDs are ObjectIds, not string.
I read the document but couldn't find any guide where we use { type: String }
I wonder if we actually could use it ?