Cheers! I get Foo (for example) object from remote server with an ID, which looks like this:
id: "5110e8b5a8fefe71e0000197"
But when I do:
App.Foo.find("5110e8b5a8fefe71e0000197")
it returns array of objects, which is wrong, 'cause all ID's are uniq in mongo.
> Array[112]
So, how to make it work?
UPDATE: My find function:
App.Foo.reopenClass({
allFoos: [],
find: function(){
$.ajax({
url: 'http://address/foos.json',
dataType: 'jsonp',
context: this,
success: function(data){
data.forEach(function(foo){
this.allFoos.addObject(App.Foo.create(foo))
}, this)
}
})
return this.allFoos;
}
});