mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
filer mongodb delete
This commit is contained in:
parent
24a8192298
commit
6234ea441b
|
@ -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 {
|
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
|
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) {
|
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 {
|
if inclusive {
|
||||||
where["name"] = bson.M{
|
where["name"] = bson.M{
|
||||||
"$gte": startFileName,
|
"$gte": startFileName,
|
||||||
|
|
Loading…
Reference in a new issue