Can mongocxx::cursor be declared globally

I use mongo c++ driver. When I declare and use mongocxx::cursor within a function it is fine.
But when I tried to declare it globally so that it can be shared among functions. It triggered an exception.

mongocxx::cursor cursor = coll.find({});

what is the proper way to do?