Browse Source

filer store: fix nil for mongodb (#6886)

fix https://github.com/seaweedfs/seaweedfs/issues/6885
pull/6845/merge
Chris Lu 4 months ago
committed by GitHub
parent
commit
5d8a391b95
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      weed/filer/mongodb/mongodb_store.go

14
weed/filer/mongodb/mongodb_store.go

@ -234,14 +234,22 @@ func (store *MongodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dir
"directory": string(dirPath),
}
nameQuery := bson.M{}
if len(prefix) > 0 {
where["name"].(bson.M)["$regex"] = "^" + regexp.QuoteMeta(prefix)
nameQuery["$regex"] = "^" + regexp.QuoteMeta(prefix)
}
if len(startFileName) > 0 {
if includeStartFile {
where["name"].(bson.M)["$gte"] = startFileName
nameQuery["$gte"] = startFileName
} else {
where["name"].(bson.M)["$gt"] = startFileName
nameQuery["$gt"] = startFileName
}
}
if len(nameQuery) > 0 {
where["name"] = nameQuery
}
optLimit := int64(limit)

Loading…
Cancel
Save