I\'m using ember-data with rails and MongoDB and am having problem with the way IDs are stored in MongoDB - in a _id field.
Ember-data will use id as the default field f
I had a similar problem using ember.js with ember-resource and couchdb, which also stores it's IDs as _id
.
As solution to this problem I defined a superclass for all my model classes containing a computed property to duplicate _id
into id
like this:
// get over the fact that couchdb uses _id, ember-resource uses id
id: function(key, value) {
// map _id (couchdb) to id (ember)
if (arguments.length === 1) {
return this.get('_id');
}
else {
this.set('_id', value);
return value;
}
}.property('_id').cacheable()
Maybe this could solve your problem too?