Are couchbase bulk operation results sorted?

Hi we want to use go sdk for bulk operations like below example:

Here is the sample code we written:

docIds := []string{"foo", "bar", "baz"}

var bulkOps = make([]gocb.BulkOp, 0, len(keys))
for _, id := range docIds {
	getOp := gocb.GetOp{
		ID: id,
	}

	bulkOps = append(bulkOps, &getOp)
}

_ = c.collection.Do(bulkOps, nil)

// Is bulkOps sorted by doc ids we gave?
for _, item := range bulkOps {
	...

}

Our question is, after

c.collection.Do(bulkOps, nil)

is it guaranteed that the order of bulkOps slice remains same (for instance for above example: with keys “foo”, “bar” and “baz” respectively)?

The reason we ask is that we may sort getResults unnecessarily and we have not seen clear documentation about that.

The result cannot be assumed to be sorted.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.