add _id to as row.id for refine useShow
Hello, im having trouble trying to get data to return in the refine useShow. MongoDB returns _id as the row.id but useShow looks for "id", is there any way to let it use _id?
_id with the hook in refine, you can utilize the meta property to specify the custom column name. This is particularly useful when your database, such as MongoDB, uses _id instead of id.meta property with tells refine to use _id as the primary key when querying the database._id field.useShowuseShow"your-resource-name""your-id-value"idColumnName: "_id"import { useShow } from "@refinedev/core";
const { queryResult: showResponse } = useShow({
resource: "your-resource-name",
id: "your-id-value",
meta: {
idColumnName: "_id",
},
});
console.log(showResponse.data.data);