plugin-graphql icon indicating copy to clipboard operation
plugin-graphql copied to clipboard

toPrimaryKey broke ObjectId from MongoDB

Open Dotrox opened this issue 4 years ago • 1 comments

When I get data from the server all ObjectId cuts because of this method. For example "6018b21ff77a7f08047de270" become "6018" And id: this.string() in vuex-orm models doesn't help!

https://github.com/vuex-orm/plugin-graphql/blob/b6a878d4d8aed66a8634eb846f3894cac4d2e65f/src/support/utils.ts#L140

Why the Hell there is parseInt without checking field type?!

Dotrox avatar Feb 02 '21 02:02 Dotrox

Same problem, my ids looks like tyr13zqj, without strange prefixes of $uid. We need just to set it as is. Why the Hell we have that conversion of existing data? Plugin must not to change data inside, it just a transport utility.

As workaround, maybe introduce option like 'custom id prefix', which we can set manually while installing the plugin: u- for u-6018b21ff77a7f08047de270 or t for tyr13zqj.

But better to leave it without internal changes. If you have a string, you must show it as string.

Arsync avatar Mar 21 '21 12:03 Arsync