4

Is there a way within the Simperium JS client to delete an item from a bucket?

The other APIs appear to be able to do so.

I've tried using:

bucket.update(id, null)

bucket.update(id, undefined)

But these don't seem to do anything. There is no bucket.delete or bucket.remove that I can see.

Matthew Schinckel
  • 35,041
  • 6
  • 86
  • 121
  • if the underlying structure of the `bucket` is a javascript object (most likely) you can use the `delete` keyword. this hackish way may be the only way since it doesnt seem like simperium provides an API for this. – jbabey Jun 01 '12 at 13:25
  • I have the same problem. There is something in the HTTP API, though. https://simperium.com/docs/reference/http/#objectdelete Although I would have preferred a .delete method. – Donovan Jun 01 '12 at 14:21
  • @jbabey: Deleting the object out of the current scope does nothing about removing the object from the persistent store. – Matthew Schinckel Jun 01 '12 at 14:27
  • @Alberteddu: yeah, the HTTP API can do it. But that kind-of defeats the purpose of a JS abstraction :) I'm hoping it's just an oversight (since the python version can delete objects out of a bucket). – Matthew Schinckel Jun 01 '12 at 14:28
  • I asked them on twitter, I will let you know. – Donovan Jun 01 '12 at 14:55

1 Answers1

1

When you update that id, the 'local' callback for that id should also return null. That should delete the object from the bucket.

ecksor
  • 390
  • 1
  • 6
  • 1
    That might be something you might want to put into the documentation. Either that, or allow explicitly passing `null` into update to delete the object. – Matthew Schinckel Jun 02 '12 at 03:55