Details
-
Bug
-
Resolution: Unresolved
-
Minor - P4
-
None
-
1.3.0
-
None
Description
The driver parses a string $id field, but per the spec, this must be an object ID, not a string.
Repro:
package main
|
|
|
import (
|
"encoding/hex"
|
"fmt"
|
"log"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
)
|
|
|
func main() {
|
input := `{"":{"$dbPointer":{"$ref":"","$id":"000000000000000000000000"}}}`
|
|
|
var output bson.Raw
|
err := bson.UnmarshalExtJSON([]byte(input), false, &output)
|
if err != nil {
|
log.Fatal(err)
|
}
|
|
|
fmt.Println(hex.EncodeToString(output))
|
}
|
Output:
180000000c00010000000000000000000000000000000000
|