Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

filer mongodb delete

bukton6234ea441b63
diff --git a/weed/filer2/mongodb/mongodb_store.go b/weed/filer2/mongodb/mongodb_store.go
index 912053cbec..d0d8dcf2c2 100644
--- a/weed/filer2/mongodb/mongodb_store.go
+++ b/weed/filer2/mongodb/mongodb_store.go
@@ -110,6 +110,12 @@ func (store *MongodbStore) FindEntry(ctx context.Context, fullpath util.FullPath
func (store *MongodbStore) DeleteEntry(ctx context.Context, fullpath util.FullPath) error {
+ where := bson.M{"directory": fullpath}
+ _, err := store.connect.Database(store.database).Collection(store.collectionName).DeleteOne(ctx, where)
+ if err != nil {
+ return fmt.Errorf("delete %s : %v", fullpath, err)
+ }
+
return nil
}
@@ -120,7 +126,7 @@ func (store *MongodbStore) DeleteFolderChildren(ctx context.Context, fullpath ut
func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {
- var where = bson.M{"directory": string(fullpath), "name": bson.M{ "$gt": startFileName, }}
+ var where = bson.M{"directory": string(fullpath), "name": bson.M{"$gt": startFileName,}}
if inclusive {
where["name"] = bson.M{
"$gte": startFileName,