add random string generator, fix mongo provider implementation of metadataquery