aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbukton <buk_ton2@hotmail.com>2020-04-19 00:20:00 +0700
committerbukton <buk_ton2@hotmail.com>2020-04-19 00:20:00 +0700
commit6234ea441b6388838a19635c656316047f42917d (patch)
treedae7d7a66a1d954ad7f0c33788c2b794f79ed12a
parent24a81922984aacedf37b383299a590fe764102b1 (diff)
downloadseaweedfs-6234ea441b6388838a19635c656316047f42917d.tar.xz
seaweedfs-6234ea441b6388838a19635c656316047f42917d.zip
filer mongodb delete
-rw-r--r--weed/filer2/mongodb/mongodb_store.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/filer2/mongodb/mongodb_store.go b/weed/filer2/mongodb/mongodb_store.go
index 912053cbe..d0d8dcf2c 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,