| 57 | } |
| 58 | |
| 59 | func TestName10(t *testing.T) { |
| 60 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) |
| 61 | defer cancel() |
| 62 | cli := Result(mongo.Connect(ctx, options.Client().ApplyURI("mongodb://openIM:openIM123@172.16.8.48:37017/openim_v3?maxPoolSize=100").SetConnectTimeout(5*time.Second))) |
| 63 | |
| 64 | v := &MsgMgo{ |
| 65 | coll: cli.Database("openim_v3").Collection("msg3"), |
| 66 | } |
| 67 | opt := options.Find().SetLimit(1000) |
| 68 | |
| 69 | res, err := mongoutil.Find[model.MsgDocModel](ctx, v.coll, bson.M{}, opt) |
| 70 | if err != nil { |
| 71 | panic(err) |
| 72 | } |
| 73 | ctx = context.Background() |
| 74 | for i := 0; i < 100000; i++ { |
| 75 | for j := range res { |
| 76 | res[j].DocID = strconv.FormatUint(rand.Uint64(), 10) + ":0" |
| 77 | } |
| 78 | if err := mongoutil.InsertMany(ctx, v.coll, res); err != nil { |
| 79 | panic(err) |
| 80 | } |
| 81 | t.Log("====>", time.Now(), i) |
| 82 | } |
| 83 | |
| 84 | } |
| 85 | |
| 86 | func TestName3(t *testing.T) { |
| 87 | t.Log(uint64(math.MaxUint64)) |