"not authorized to execute command aggregate out" with createCollection

I use mongodb 4.4, and I am trying to give RO users privilleges to export result to csv.
I have done custom role and granted it to user:

db.createRole(
 {
   role: "supp_export",
   privileges: [
     { resource: { db: "", collection: "export" }, actions: [ "createCollection", "createIndex", "dropCollection" ]},
	 { resource: { db: "", collection: "export2" }, actions: [ "createCollection", "createIndex", "dropCollection" ]}
   ],
   roles: []
 }
)
 
db.createUser({
  user: "ro_test",
  pwd: "ro_test",
  roles: [ { role: "readAnyDatabase", db: "admin" }]
});		
 
db.grantRolesToUser(
   "ro_test",
   [ { role: "supp_export", db: "admin" } ]
);

I authorized as ro_test and tried to create “export” collection, it was success operation, but in aggregation pipeline I got an error on “out” step:

not authorized on test to execute command { aggregate: “movies”, pipeline: [ { $out: “export” } ], allowDiskUse: true, cursor: {}, maxTimeMS: 60000, lsid: { id: UUID(“b0a59b57-b8b6-43a8-a37f-497a83c6ed46”) }, $clusterTime: { clusterTime: Timestamp(1698241761, 2), signature: { hash: BinData(0, DB8554C97E979B3CDD7135650156BE51478028F7), keyId: 7241112465017143305 } }, $db: “test” }
As I unserstand, “out” creates new collection.

$out will need permissions to create a collection as far as I’m aware. We have a situation setup with a temporary working database on production where developers can create collections on that for working with data which works well.

May you are using older mongo version try with 6 version or above version