Closed j2L4e closed 8 years ago
What does your setup look like? I think that most of the weirdness is happening because the id is converted to a string. You may have to parseInt
it in a before
hook for update
and patch
.
I checked and on the wire 'id' is a string already. 42["messages updated",{"text":"I changed another time","id":"1"}]
So it appears to be a server-side problem. Sorry for the confusion.
I created the server using the CLI. 'generate', 'generate service'. No auth, memoryDB. However, this is totally a bug. Want me to file it somewhere else?
edit: can confirm that updating the same entry again (id "1"
) works as expected.
Oh, I wasn't saying this isn't a bug, I'm just trying to figure out how to reproduce it. From what I got:
.find()
Never had the feeling you were!
Yep, POSTing works fine, the problem occurs after PUTting a new value:
$ curl 'http://localhost:3030/messages' -H 'Content-Type: application/json' --data-binary '{ "text": "read me!" }'
{"text":"read me!","id":0}
$ curl 'http://localhost:3030/messages' -H 'Content-Type: application/json' --data-binary '{ "text": "read me!" }'
{"text":"read me!","id":1}
$ curl 'http://localhost:3030/messages/1' --request PUT -H 'Content-Type: application/json' --data-binary '{ "text": "I changed" }'
{"text":"I changed","id":"1"}
This was a bug in feathers-memory that has been fixed with https://github.com/feathersjs/feathers-memory/pull/26. I think most other database adapters should not have that problem. Thanks for reporting!
Say I have a 'messages' service with 3 existing messages. I query those via .find() and subscribe:
I now change one of the messages (id 1) using cURL. The Observable emits the following object:
Several things are unexpected:
total changed to 0. Expected 3 (or 4 in case of not removed item).not sure about this, couldn't reproduce