Query for META().id FROM subquery results

I am trying to run a query to get the document keys for items that have duplicate field values.

Can I run a single query to get the document keys for the results of this query? Or rewrite the query to accomplish the goal above?

SELECT t1.somefield, t1.fieldcount FROM
(SELECT somefield, fieldcount FROM `mybucket` WHERE `somefield` IS NOT MISSING GROUP BY somefield
LETTING fieldcount = COUNT(somefield) ) as t1
WHERE t1.fieldcount > 1;
SELECT d.somefield, cnt, docids
FROM mybucket AS d
WHERE d.somefield IS NOT NULL
GROUP BY d.somefield
LETTING cnt = COUNT(1), docids = ARRAY_AGG(META(d).id)
HAVING cnt > 1;

OR

SELECT d.somefield, ARRAY_LENGTH(docids) AS  cnt, docids
FROM mybucket AS d
WHERE d.somefield IS NOT NULL
GROUP BY d.somefield
LETTING docids = ARRAY_AGG(META(d).id)
HAVING ARRAY_LENGTH(docids)  > 1;

Thank you! This works well.