opts := options.FindOne().SetProjection(bson.M{"username": 1})
users.FindOne(ctx, bson.M{"username": "kotcich"}, opts).Decode(&user)
with temp as (
DELETE FROM microservices_transports AS mt WHERE mt.transport_id = :next AND mt.microservice_id = microservice_id RETURNING *)
is_default = COUNT(select * from t WHERE is_default = TRUE) > 0
, select g.id, g.name, g.description, g.bar_code, coalesce(s.count,0) as total_sales, coalesce(r.count, 0) as total_receipts, coalesce(r.count, 0) -coalesce(s.count, 0) as total from good g left join (select good_id, count(*) from receipt group by good_id) r on g.id = r.good_id
left join (select good_id, count(*) from sale group by good_id) s on g.id = s.good_id
Без .Decode(&user) запрос всё равно произойдёт. потому что Collection.FindOne() делает запрос и возвращает ссылку на результирующую структуру.