RavenDB - deleting previously-conflicted documents with "/conflicts" in URL -
i’m trying programmatically delete once-conflicted documents no longer conflicted, still showing duplicates in raven.
e.g. if query index on entity’s property know unique 2 documents back
- document url entities/12345
- document b url entities/12345/conflicts/54321
my goal delete document b.
loading document session not throw conflictexception, not flagged being conflicted more. can delete document b via web ui, can’t via code yet, can see in transient context via stream.
here’s sample code explains getting various client calls when trying resolve this…
using (var enumerator = session.advanced.stream(query)) { while (enumerator.movenext())) { var entity = enumerator.current.document; // attempt id returns null var id = session.advanced.getdocumentid(entity); // throws invalidoperationexception var url = session.advanced.getdocumenturl(entity); // returns null, can’t use session delete session.load<tentity>(entity); // nothing, string id of entity session.advanced.defer(new deletecommanddata { key = entity.id.tostring() }); // nothing session.advanced.documentstore.databasecommands.delete(entity.id.tostring(), null); } session.savechanges(); }
any gratefully received!
i found using enumerator.current.key
in example above gave me key document after.
Comments
Post a Comment