ambitious-aqua
ambitious-aqua•2y ago

Inferencer - how to use a diferent identifer id

Hi, I want to use the Inferencer (MUI) to generate the views for my data. However, my data use the key "_id" instead of "id" as my identifier (I'm using mongodb database). Is there a way to parameters the Inferencer to use _id instead of id? Thanks a lot
4 Replies
foreign-sapphire
foreign-sapphire•2y ago
Hello @yacine4340 , hope you are doing well! Unfortunately it's not possible at the moment. Inferencer expects ID field to be present. You can explore if it's possible to return id field, instead of _id from the data provider. If your problem persists, feel free to create an issue on GitHub. Best
compatible-crimson
compatible-crimson•2y ago
Also you can do customize your data provider to add id field according to the '_id'. So the change will only happen in refine side
plain-purple
plain-purple•2y ago
Went to post a new question and saw this discussion. @yacine4340 you can check out this (rather long) discussion we had https://discord.com/channels/837692625737613362/1067070739389354065. Tldr; you can take the Inferencer code and customize it, and take the id prop instead of the hard-coded 'id'. Obviously a workaround, hopefully sometime in the next big version^tm we'll get access to this change more easily 🙂
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
ambitious-aqua
ambitious-aqua•2y ago
@batuhanw @aliemirs Thanks for the quick feedback. I followed your direction with a custom data provider and it worked.