如何从我的收藏中返回与某些自定义 ID(不是常规 ID)匹配的记录?
// record schema
{
id: 123, // assigned id from mirage
dId: 'DEVICE0001', // device id I want to use to pick
value: 'some content'
}
要选择这样的东西:
// app/mirage/config.js
this.get("/something/:device_did", function(db, request){
var did = request.params.device_did;
// select using my device id
return db.devices.firstWhere( { 'dId': did });
});
API 文档仅引用了作用于 id 的“find()”函数和获取记录数组的“where()”。