TMongoWire
TMongoWire copied to clipboard
toughen IBSONDocumentEnumerator against null elements
Hi, Just trying out example1 and getting an 'invalid pointer error' when trying to refresh or load documents with a null field. Will you be looking at this anytime soon? Thanks
It's not strictly related to this issue, but there was indeed a bug. Please update to the recent commit.
Then again. Having a second look, this bug may have caused me to post this issue way back then. If I try IBSONEnumerator over {{x:1},null,{x:2}}
now it now fails because Can't mix documents and non-documents with IBSONDocumentEnumerator
. If I were ever to make IBSONDocumentEnumerator support null elements in the array, I'd have to change:
-
stmReadBSONDocArray
if l=bsonNull, but then skip the part where the object's length is read (since there's nothing there) -
TBSONDocumentEnumerator.Next
if FPos[FPosCurrent]= 0 or -1 or something invalid just to not do Load, but do a 'Reset' to at least inc(FLoadIndex) on the document or something - see what an array that starts with an element
bsonNULL
does, as it currently doesn't lead intostmReadBSONDocArray
... - decide if it's important that
{{x:1},null,{x:2}}
and{{x:1},{},{x:2}}
will behave exactly the same...