Paging Mongodb Golang

[Solved] Paging Mongodb Golang | Perl - Code Explorer | yomemimo.com
Question : paging mongodb golang

Answered by : mohammad-ghari

func GetUsers (page, limit int) { filter := bson.D{{}} // selects all documents options := new(options.FindOptions) if limit != 0 { if page == 0 { page = 1 } options.SetSkip(int64((page - 1) * limit)) options.SetLimit(int64(limit)) } cursor, err := mongoCollection.Find(context.TODO(), filter, options)
...
}

Source : | Last Update : Fri, 17 Jun 22

Answers related to paging mongodb golang

Code Explorer Popular Question For Perl