Following the samples in the RavenDB Attachment docs and RavenDB Attachments - Functionality how to do?, I'm trying to add attachments to a Raven instance with the following code:
foreach (var currentDoc in docsToStore) {
byte[] buff = ReadBytesFromFile(currentDoc.FilePath);
var attachmentId = "attachedpages/" + attachmentCounter;
var stream = new MemoryStream(buff);
documentStore.DatabaseCommands.PutAttachment(attachmentId, null, stream, null);
currentDoc.Attachments.Add(attachmentId);
session.Store(currentDoc); //Add the new document to Raven
}
session.saveChanges();
I've looked in the debugger to confirm that the MemoryStream has the data I expect. I also see the reference to currentDoc in the management studio. However, http://localhost:8080/static/?start=0&pagesize=128
simply returns an empty array.
Is there another step I need to take in order to save attachments?