From 1a55ac68d3e4497315dcb84ab53eae9c38dbe151 Mon Sep 17 00:00:00 2001 From: Prabhjot Singh Sethi Date: Thu, 17 Apr 2025 11:03:45 +0000 Subject: [PATCH] Handle nil filter in find many Signed-off-by: Prabhjot Singh Sethi --- db/mongo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/mongo.go b/db/mongo.go index aa34ab8..2fbea20 100644 --- a/db/mongo.go +++ b/db/mongo.go @@ -141,6 +141,9 @@ func (c *mongoCollection) FindOne(ctx context.Context, key interface{}, data int // Find multiple entries from the store collection for the given filter, where the data // value is returned as a list based on the object type passed to it func (c *mongoCollection) FindMany(ctx context.Context, filter interface{}, data interface{}) error { + if filter == nil { + filter = bson.D{} + } cursor, err := c.col.Find(ctx, filter) if err != nil { return err