Database
[{"startSearch":"2021-04-23T15:12:59.161Z","endSearch":"2021-04-23T15:13:00.501Z","elapsedTime":1.34,"totalRecordsFound":224,"specialSearch":"Test","AccountStatus":"Active, Bankruptcy, Out For Repo, Repossessed","AccountType":"","Location":"","LastName":"","FirstName":"","AccountId":"","Phone":""},{"startSearch":"2021-04-23T15:12:59.161Z","endSearch":"2021-04-23T15:13:00.501Z","elapsedTime":0.745,"totalRecordsFound":224,"specialSearch":"Test2","AccountStatus":"Active","AccountType":"","Location":"","LastName":"","FirstName":"","AccountId":"","Phone":""},{"startSearch":"2021-04-23T15:12:59.161Z","endSearch":"2021-04-23T15:13:00.501Z","elapsedTime":0.91,"totalRecordsFound":224,"specialSearch":"Test2","AccountStatus":"Active, test of value","AccountType":"","Location":"","LastName":"","FirstName":"","AccountId":"","Phone":""}]
Query
db.collection.aggregate([{$match:{$and:[{"specialSearch":{$ne:""}},{$expr:{$gt:[{$size:{"$split":["$AccountStatus",","]}},1]}}],}},{$group:{_id:null,averageSearchDuration:{$avg:"$elapsedTime"}}}])