Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We solve it using an "archive" collection in mongodb. Deleting moves a document from one collection to the archive, while undo moves it back.

We also implement ability to find deleted documents by id, by searching the archive if the record is not found in the original collection.

API looks like this:

    // delete something
    delete("/products/123")
    
    // see it in the archive
    get("/archive/products/123")
    
    // undelete it
    put("/products/123", {$restore: true})


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: