You can delete the documents with invalid IDs server via a stored procedure which can be executed from the v3 SDK without downgrading the v2 SDK version e.g.:
function deleteMyDoc(docId) {
var collection = getContext().getCollection();
var query =
{
'query' : 'SELECT * FROM c where c.id = @docId',
'parameters' : [{'name':'@docId', 'value': docId}]
};
if(!collection.queryDocuments(
collection.getSelfLink(),
query,
function (err, docs, options) {
if (err) throw err;
if (!docs || docs.length !== 1) {
var response = getContext().getResponse();
response.setBody('Document Not Found');
}
else {
var suppression = docs[0];
if(!collection.deleteDocument(suppression._self, {etag: suppression.etag})) {
throw new Error('Delete was not accepted by the server.');
}
var response = getContext().getResponse();
response.setBody("Document Deleted");
}
}
)){
throw new Error('The query was not accepted by the server.');
}
}
An then execute from c#
var invalidId = "grabage/junk";
await container.Scripts.ExecuteStoredProcedureAsync<string>("deleteMyDoc", new PartitionKey("my partition key"), new[] { invalidId });