I have been developing on Lotus Notes for quite sometime but I have never
really administer a database.
In many application database I notice that if I create a view to select all
documents in the database using Select @All and count the number of documents
this doesn’t tally with the number of documents shown the the database
properties.
{]
{]
When soft delete is enabled this could obviously be be due to the deletion
stub. In this case for example soft delete has been disabled,
Can anyone explain where these differences come from?
Subject: RE: How to interpret database properties “documents” size
Michelle
Thanks for responding, I found some documents that somehow didnt show up in the view Select @All. It is strange but I need to understand how that could have happened.
Subject: RE: How to interpret database properties “documents” size
No, when you delete a document, it’s really deleted. But if a view is hierarchical, and the parent document no longer exists (or exists but isn’t selected by the view selection formula) then the responses will not display because there’s nothing for them to attach to. To really see all the documents, make the view non-hierarchical.
Subject: RE: How to interpret database properties “documents” size
If soft deletions are enabled, then of course the document is not really deleted right away.
Otherwise, there are things that can make the document appear to still be there:
A deleted document is converted to a “deletion stub”, so that when you replicate the database it will know that the document has been deleted and will delete it from another replica. The deletion stub has the same UNID as the document.
Please note the IsDeleted property of NotesDocument, which can be used to tell whether a supposed document is really a deletion stub.
Also, NotesDocument objects are help in cache by the client, and if the document is deleted without the LotusScript environment getting to know about it, it might still be in the cache.
I’m not sure offhand whether a soft-deleted document will still show up as a response. But if a document is hard-deleted, it’s gone. The data has been overwritten for security (usually) and the deletion stub with that ID is not a document.
Subject: RE: How to interpret database properties “documents” size
The number of documents is read when you open the database, and isn’t updated until you exit and re-enter the database – at least in the case of existing documents being changed to deletion stubs. You will need to close all windows to the database, including in Designer.
Yes, the deletion stub is still a response to the original document, but it still is a deletion stub, not a document. Try this code (note the test of IsValid):
Dim strDat$, strOne$
Dim collResp As NotesDocumentCollection
Set collResp = doc.Responses
Dim resp As NotesDocument
strDat = {'} & doc.Subject(0) & {', responses=} & collResp.Count
Set resp = collResp.GetFirstDocument
Do Until resp Is Nothing
If resp.IsDeleted Then
strOne = "DELETED: noteid=" & resp.NoteID
Elseif Not resp.IsValid Then
strOne = "DELETION STUB: noteid=" & resp.NoteID
Else
strOne = {'} & resp.Subject(0) & {' noteid=} & resp.NoteID
End If
strDat = strDat & NL & strOne
Set resp = collResp.GetNextDocument(resp)
Loop
Msgbox strDat
Subject: RE: How to interpret database properties “documents” size
I don’t understand what you mean by “ghost” that’s different from a deletion stub. The NotesDocument object you get from Responses is a handle to the deletion stub. Your own output shows IsValid=False, which means it’s a deletion stub – read the doc. The deletion stub does not contribute to the count of documents (once you’ve exited the database so that the count is refreshed in the UI). If you’re saying something else, I’m missing it – it seems like you just feel like calling a deletion stub a “ghost” instead. Fine, call it what you like.
Subject: RE: How to interpret database properties “documents” size
My argument is that:A document is not immediately deleted from a database when soft deletions are disable, as you said before.
This can be seen in my example. There is a 0-sized document (a deletion stub, if you prefer) that is returned by the Responses property.
And, from my point of view, this is wrong and code is needed to workaround it.
Also, this document is kept as part of the number of documents in the database, which is also wrong, since it was deleted and became a deletion stub, right??
It is important to say again: this only happens when a document is deleted and it has responses.
This is not really a big deal, but in an application that has to handle response trees using lotus script or when users remove docs that has responses document count is affected.