auto cursor = db[collectionname].find();
foreach( rec; cursor) {
    s = rec[fieldname].to!string;
    // rec[fieldname] is a Bson string
}

Here s is assigned quoted text looking like a string literal if printed, i.e. as if Bson is being converted to Json text, suitable for display in the console or a log.

However, what if we want to get the string, not its representation as a string literal?

We can do this if we use a struct to represent each of the results of find, but this is not possible if the structure of the collection is not known at compile time. So how do we proceed in this dynamic case?