enable clearing of server documents, also store correctly

issues: fixes #1437 

ping @hhuuggoo @mattpap for review