Hi Lars,
On Fri, Nov 16, 2012 at 10:01 AM, Lars Pensjö <
lars....@gmail.com> wrote:
> I am investigating the use of mgo for MongoDB, but I can't find information
> about thread-safety (goroutines). Can you point me somewhere to read more?
>
> That is, do you need a unique session for each thread? Will that be thread
> safe?
mgo is fully goroutine-safe, and you can share sessions across as
needed for your application. The only thing to keep in mind is that
when sharing a Strong or Monotonic session, a single underlying socket
is used to the database for all goroutines sharing that session. It
works fine, and that has both advantages and disadvantages depending
on the specific need.
gustavo @
http://niemeyer.net