D
D
Dima Zherebko2016-02-12 18:53:21
MongoDB
Dima Zherebko, 2016-02-12 18:53:21

Why doesn't mogolab save objects (golang, driver "gopkg.in/mgo.v2", )?

only ID is added to Mongolian.
I can't figure out what could be the problem.
"_id": {
"$oid": "56bdfce2e8d67ac70dfe137e"
}


col := session.DB(database).C(collection)
session.SetMode(mgo.Monotonic, true)
session.SetMode(mgo.Monotonic, true)
count, err2 := col.Count()
if err2 != nil {
panic(err2)
}
fmt.Println(fmt.Sprintf("Messages count: %d", count))
err = session.DB(database).Login(username, password);
if err != nil {
panic(err)
}
err = col.Insert(&Person{name:"TestName", Pone:"+365756765"})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question