Skip to content

Commit 6eda007

Browse files
authored
Replace all uses of 'interface{}' with 'any' in the repo docs. (#2142)
1 parent 0c9c840 commit 6eda007

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/common-issues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if err != nil {
4444
log.Fatalf("error encoding json: %v", err)
4545
}
4646

47-
m := make(map[string]interface{})
47+
m := make(map[string]any)
4848
if err := json.Unmarshal(jsonBytes, &m); err != nil {
4949
log.Fatalf("error decoding json: %v", err)
5050
}

docs/migration-2.0.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fmt.Printf("car-renting persons: %v\n", people)
189189

190190
#### InsertMany
191191

192-
The `documents` parameter in the `Collection.InsertMany` function signature has been changed from an `[]interface{}` type to an `any` type. This API no longer requires users to copy existing slice of documents to an `[]interface{}` slice.
192+
The `documents` parameter in the `Collection.InsertMany` function signature has been changed from an `[]any` type to an `any` type. This API no longer requires users to copy existing slice of documents to an `[]any` slice.
193193

194194
```go
195195
// v1
@@ -209,7 +209,7 @@ books := []book{
209209
},
210210
}
211211

212-
booksi := make([]interface{}, len(books))
212+
booksi := make([]any, len(books))
213213
for i, book := range books {
214214
booksi[i] = book
215215
}
@@ -633,13 +633,13 @@ The following types are not valid for a `findOne` operation and have been remove
633633
634634
### FindOneAndUpdateOptions
635635
636-
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` field in the `FindOneAndUpdateOptions` struct now uses the `[]interface{}` type. The `ArrayFilters` field (now of type `[]interface{}`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.
636+
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` field in the `FindOneAndUpdateOptions` struct now uses the `[]any` type. The `ArrayFilters` field (now of type `[]any`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.
637637
638638
### UpdateManyOptions / UpdateOneOptions
639639
640640
The `UpdateOptions` has been separated into `UpdateManyOptions` and `UpdateOneOptions` to configure the corresponding `UpdateMany` and `UpdateOne` operations.
641641
642-
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` fields in the new `UpdateManyOptions` and `UpdateOneOptions` structs (which replace the old `UpdateOptions` struct) now use the `[]interface{}` type. The `ArrayFilters` field (now of type `[]interface{}`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.
642+
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` fields in the new `UpdateManyOptions` and `UpdateOneOptions` structs (which replace the old `UpdateOptions` struct) now use the `[]any` type. The `ArrayFilters` field (now of type `[]any`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.
643643
644644
### Merge\*Options
645645

0 commit comments

Comments
 (0)