My database creates ids with this format:
{"_id":{"$oid: "511c699s373f"}, name:'john', age:30}
When calling ".erase()" on an object, the paramaters sent to the
restful adapter are "id" and "type: DELETE".
Since there's no "id", I get this error:
'agility.js: erase() needs model id'
I fixed it temporarily why editing the erase function in Agility. But
I'd like to do all the modifications right on the adapter, so I don't
touch Agility's code for a particular case.
The question is, how can I do it?
If no parameters are sent, and an error message is thrown instead, how
can construct the correct parameter to be sent to the ajax call?
I tried adding an "id" parameter to persist (in my client code), as
the docs suggest, as follows:
.persist($$.adapter.restful, {
baseUrl: '
https://api.mongolab.com/api/1/databases/friends/
collections/',
collection: 'school',
apiKey: '4fdcfee7e4b0efd21e19e7ac',
id: '_id["$oid"]'
});
But it doesn't seem to work. Any hint?