# How do I fix the "Cannot create property \_id on string" type error? When attempting to assign the `_id` property to a string during a MongoDB import, you may get the following error: ``` TypeError: Cannot create property `_id` on string ``` This error occurs when you try to manually assign `_id`, which is a reserved field in MongoDB. In most cases, you do not need to manually assign the `_id` field during the import process. When importing data into MongoDB, the database automatically assigns an `_id` as the unique identifier for each document. To fix this error, you can remove the `_id` field from your JSON data file. MongoDB then automatically generates the `_id` values for each document during the import process. For example, a `data.json` file may look like this: ```json [ { "name": "John Doe" }, { "name": "Jane Doe" } ] ``` Then, when importing `data.json` into MongoDB, the database automatically generates the `_id` values needed for each document in `data.json`, like this: ```json [ { "_id": ObjectId("6174f998f7c34a001f4efbc2"), "name": "John Doe" }, { "_id" : ObjectId("6174f99af7c34a001f4efbc3"), "name": "Jane Doe" } ] ``` ## Related Topics [How do I fix the "DNSHostNotFound Failed to look up service" error?](https://docs.digitalocean.com/support/how-do-i-fix-the-dnshostnotfound-failed-to-look-up-service-error/index.html.md): Use a public DNS server, such as Google’s 8.8.8.8, to resolve SRV lookups required by MongoDB’s connection string. [How do I unblock my MongoDB database?](https://docs.digitalocean.com/support/how-do-i-unblock-my-mongodb-database/index.html.md): Increase your cluster’s disk space or delete data to unblock your MongoDB database. [How do I fix the "Connection Refused" error when connecting to my database?](https://docs.digitalocean.com/support/how-do-i-fix-the-connection-refused-error-when-connecting-to-my-database/index.html.md): Verify the connection string, ensure correct port usage, and add your local machine to the database cluster’s trusted sources.