txn Update => replace document

14 views
Skip to first unread message

Davis Ford

unread,
Jun 23, 2015, 1:48:56 PM6/23/15
to mgo-...@googlegroups.com
Is it possible to completely replace a document using txn.Ops http://docs.mongodb.org/manual/tutorial/modify-documents/#replace-a-document

I have a doc with many fields, and I'd rather not try to pass around an Ops array of changesets as that leaks all over my API.  I'd prefer to just pass the struct pointer around of the thing to be replaced after modifications have been made.

Looks like it can be done with native mongo driver, but I wasn't sure if it could be done in txn.Ops ?

Gustavo Niemeyer

unread,
Jun 24, 2015, 4:03:47 AM6/24/15
to mgo-...@googlegroups.com
Hi Davis,

No, that's not possible as there are fields in the document that are relevant for the txn package and must be respected when modifications are made.

--
You received this message because you are subscribed to the Google Groups "mgo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mgo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages