Use explicit db ref to create document instead of relying on thread-local