// Create a wait group to manage the goroutines. var waitGroup sync.WaitGroup // Perform 10 concurrent queries against the database. waitGroup.Add(10) for query := 0; query < 10; query++ { go RunQuery(query, &waitGroup, mongoSession) } // Wait for all the queries to complete. waitGroup.Wait() log.Println("All Queries Completed")