[GODRIVER-76] Document what types are allowed for BSON `interface{}` Created: 11/Sep/17  Updated: 06/Feb/18  Resolved: 06/Feb/18

Status: Closed
Project: Go Driver
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 0.0.1

Type: New Feature Priority: Major - P3
Reporter: Samuel Rossi (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: GODRIVER Alpha UX

 Description   

The `interface{}` type is used many places in the driver's API to accept an arbitrary BSON type or annotated struct. We should come up with standard phrasing to document this.



 Comments   
Comment by Githook User [ 06/Feb/18 ]

Author:

{'email': 'kris@mongodb.com', 'name': 'Kris Brandow', 'username': 'skriptble'}

Message: Document types allowed for interface{} documents

GODRIVER-76

Change-Id: Icf6b137d2e5b3b0ba17061bbda558d1264eefe5c
Branch: master
https://github.com/10gen/mongo-go-driver/commit/eba43bf01bd9db87f8af98171b99a5faa99e0463

Comment by David Golden [ 05/Feb/18 ]

It seems odd that we'd take slices/arrays as well as "document" types in the same empty interface. E.g. InsertMany is `[]interface{}`.

Ideally, we could reference a function in the `bson` package and say "anything valid for EncodeDocument" for instance and then define the specifics there, one.

Comment by Kristofer Brandow (Inactive) [ 05/Feb/18 ]

david.golden Any suggestions on the language for this? We can accept maps, slices, arrays, structs, *bson.Document, and bson.Reader.

Generated at Thu Feb 08 08:33:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.