我已经编写了一些代码来在 MongoDB 中存储图像文件。现在我想从 mongoDB 中过滤和检索一些图像。我想过滤掉一些图像名称上有一些字符集的图像。例如:假设我在 mongoDB 中存储了 aaaa_DEX.jpg、bbbb_DEX.jpg、cccc_BVX.jpg、dddd_OUI.jpg、eeee_DEX.jpg 图像,我想获取所有名称上带有“DEX”的图像。查询生成器可以吗?我怎样才能做到这一点?
要上传我使用:
public JsonResult UploadPrimaryImage(string hotelCode)
{
    var db = _hoteldbObj.Instance();
    var primaryImageBucket = new MongoGridFS(db, new MongoGridFSSettings() {Root = "HotelPrimaryImage"});
    foreach (string httpFile in Request.Files)
    {
        var postedFile = Request.Files[httpFile];
        if(postedFile == null)
            throw new InvalidOperationException("Invalid file");
        var bytes = ReadToEnd(postedFile.InputStream);
        using (var c = primaryImageBucket.Create(hotelCode, new MongoGridFSCreateOptions() { ContentType = postedFile.ContentType }))
        {                    
            c.Write(bytes, 0, bytes.Length);
            c.Flush();
            c.Close();
        }
    }
    return new JsonResult();
}
谢谢你