globalsign / mgo

The MongoDB driver for Go
Other
1.97k stars 231 forks source link

update innerdocument #313

Closed LucaPaterlini closed 5 years ago

LucaPaterlini commented 5 years ago

hello, I am trying to update an inner document contained into an array. As input I have the the id of the outer document and the id of the inner document.

This is the query in mongodb javascript sintax

db.getCollection('accounts').update({ _id: "TestLedgerAddCheck", "history.tx": "ed95e7fee5a19a449023b1d8143d569b2be7b9043bbd18e4c4134b4b93e087cf" },{ $set: {"history.$.time": 42} }, false, true );

I would like to run this query from go, what is the standard syntax in mgo , is there at list the chance to raw this raw version of the query at least?

Tk in advance, LP

eminano commented 5 years ago

Hi @LucaPaterlini,

We use the issue tracker to track bugs with mgo - if you have a usage question, it's best to try Stack Overflow :)

Thanks, Esther