M
Size: a a a
VM
J
getPostId:=func (id bson.ObjectId) {
collection := client.Database("my_database").Collection("Information about host")
filter := bson.D{}
var data Data
err := collection.FindOne(context.TODO(), filter).Decode(&data)
if err != nil {
log.Fatal(err)
}
fmt.Println("Found post with title", data.Host)
}
в передаче аргумента id bson.ObjectId пишет undefined: bson.ObjectIdRL
getPostId:=func (id bson.ObjectId) {
collection := client.Database("my_database").Collection("Information about host")
filter := bson.D{}
var data Data
err := collection.FindOne(context.TODO(), filter).Decode(&data)
if err != nil {
log.Fatal(err)
}
fmt.Println("Found post with title", data.Host)
}
в передаче аргумента id bson.ObjectId пишет undefined: bson.ObjectIdJ
M
getPostId:=func (id bson.ObjectId) {
collection := client.Database("my_database").Collection("Information about host")
filter := bson.D{}
var data Data
err := collection.FindOne(context.TODO(), filter).Decode(&data)
if err != nil {
log.Fatal(err)
}
fmt.Println("Found post with title", data.Host)
}
в передаче аргумента id bson.ObjectId пишет undefined: bson.ObjectIdJ
func InsertPost(title string, body string) {
post := Post{title, body}
collection := client.Database(“my_database”).Collection(“posts”)
insertResult, err := collection.InsertOne(context.TODO(), post)
if err != nil {
log.Fatal(err)
}
fmt.Println(“Inserted post with ID:”, insertResult.InsertedID)
}
то присваивает IDJ
RL
M