Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
In the mocking library miragejs is there a way to change the id that mirage auto assigns to be called e.g. "product_id", and not "id"?

The following function, makeServer should successfully seed the mirage database such that console.log(server.db.dump()); will return { id: '1', name: 'Test Product' }.

a) is there a way to change the default name of "id" mirage uses for a given model to something else, e.g. "product_id"? (In e.g. postgresQL the id column does not need to be called "id"). b) if there is, is this a bad idea for some reason?

I have read the 'db', 'model', and 'server' sections of the API docs and haven't been able to find this. At the moment I am passing the data around with "product_id" and if I can't alter mirage I will have to alter that in order that it will return product entries that the requests it is intercepting will accept.

import { createServer, Model } from "miragejs";

export function makeServer({ environment = "test" }) {
  return createServer({
    environment,

    models: {
      product: Model,
    },

    seeds(server) {
      server.create("product", { name: "Test Product" });
    },
  });
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!