Adds testing of attachment insertion and fetching to the functional tests. Fixes bug where the connector used in the functional tests stored attachments in the wrong collection
Adds index on document ID for attachments. Fixes #338