{"action":"created","issue":{"url":"https://api.github.com/repos/go-mgo/mgo/issues/87","labels_url":"https://api.github.com/repos/go-mgo/mgo/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/go-mgo/mgo/issues/87/comments","events_url":"https://api.github.com/repos/go-mgo/mgo/issues/87/events","html_url":"https://github.com/go-mgo/mgo/issues/87","id":66267432,"number":87,"title":"The dollar ($) prefixed field '$pullAll' in '$pullAll' is not valid for storage","user":{"login":"smanji","id":11792846,"avatar_url":"https://avatars.githubusercontent.com/u/11792846?v=3","gravatar_id":"","url":"https://api.github.com/users/smanji","html_url":"https://github.com/smanji","followers_url":"https://api.github.com/users/smanji/followers","following_url":"https://api.github.com/users/smanji/following{/other_user}","gists_url":"https://api.github.com/users/smanji/gists{/gist_id}","starred_url":"https://api.github.com/users/smanji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smanji/subscriptions","organizations_url":"https://api.github.com/users/smanji/orgs","repos_url":"https://api.github.com/users/smanji/repos","events_url":"https://api.github.com/users/smanji/events{/privacy}","received_events_url":"https://api.github.com/users/smanji/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-04T02:58:14Z","updated_at":"2015-04-06T15:29:15Z","closed_at":null,"body":"I'm using MongoDB 2.6.6 and using the mgo/txn package to do an update on one collection and an insert in another.\r\n\r\nExecuting this gives the following error: The dollar ($) prefixed field '$pullAll' in '$pullAll' is not valid for storage\r\n\r\nPer the following thread, \"$ is not allowed at the beginning of a field name, since in this position it is reserved to indicate query operators like $or, $addToSet, $, etc, and allowing it as part of field names would make the query language ambiguous\":\r\nhttps://groups.google.com/forum/#!topic/mongodb-user/uViuJsl4jP8\r\n\r\nCan this package be updated to support Mongo 2.6?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/go-mgo/mgo/issues/comments/90105722","html_url":"https://github.com/go-mgo/mgo/issues/87#issuecomment-90105722","issue_url":"https://api.github.com/repos/go-mgo/mgo/issues/87","id":90105722,"user":{"login":"smanji","id":11792846,"avatar_url":"https://avatars.githubusercontent.com/u/11792846?v=3","gravatar_id":"","url":"https://api.github.com/users/smanji","html_url":"https://github.com/smanji","followers_url":"https://api.github.com/users/smanji/followers","following_url":"https://api.github.com/users/smanji/following{/other_user}","gists_url":"https://api.github.com/users/smanji/gists{/gist_id}","starred_url":"https://api.github.com/users/smanji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smanji/subscriptions","organizations_url":"https://api.github.com/users/smanji/orgs","repos_url":"https://api.github.com/users/smanji/repos","events_url":"https://api.github.com/users/smanji/events{/privacy}","received_events_url":"https://api.github.com/users/smanji/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T15:29:15Z","updated_at":"2015-04-06T15:29:15Z","body":"Hi Gustavo,\r\n\r\nThanks for your response. I'm running mongodb 2.6.6 on Mac OSX.\r\n\r\nHere's the tiniest test case I could create to reproduce my issue, it's the second transaction that gives the error -- hopefully you can point out what I'm doing wrong.\r\n\r\nIncidentally, my fix in pull request #88 resolves this issue for me... sorry for not testing it with your test suite though!\r\n\r\n```Go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"gopkg.in/mgo.v2\"\r\n\t\"gopkg.in/mgo.v2/bson\"\r\n\t\"gopkg.in/mgo.v2/txn\"\r\n\t\"time\"\r\n)\r\n\r\ntype ParentStruct struct {\r\n\tId          bson.ObjectId `json:\"id,omitempty\" bson:\"_id\"`\r\n\tUpdatedDate time.Time     `json:\"updated_date\" bson:\"updated_date,omitempty\"`\r\n}\r\n\r\ntype ChildStruct struct {\r\n\tId       bson.ObjectId `json:\"id,omitempty\" bson:\"_id\"`\r\n\tParentId bson.ObjectId `json:\"parent_id\" bson:\"parent_id\"`\r\n}\r\n\r\nfunc main() {\r\n\tmgoSession, _ := mgo.Dial(\"localhost\")\r\n\tdb := mgoSession.DB(\"test\")\r\n\ttxnCollection := db.C(\"transactionsCollection\")\r\n\tparentCollection := \"parentCollection\"\r\n\tchildCollection := \"childCollection\"\r\n\r\n\tparentId := bson.NewObjectId()\r\n\tparentObj := ParentStruct{Id: parentId, UpdatedDate: time.Now().UTC()}\r\n\r\n\tchildObj1 := ChildStruct{Id: bson.NewObjectId(), ParentId: parentId}\r\n\tchildObj2 := ChildStruct{Id: bson.NewObjectId(), ParentId: parentId}\r\n\r\n\trunner_txn1 := txn.NewRunner(txnCollection)\r\n\tops_txn1 := []txn.Op{{\r\n\t\tC:      parentCollection,\r\n\t\tId:     parentObj.Id,\r\n\t\tInsert: parentObj,\r\n\t}, {\r\n\t\tC:      childCollection,\r\n\t\tId:     childObj1.Id,\r\n\t\tInsert: childObj1,\r\n\t}}\r\n\tid_txn1 := bson.NewObjectId() // Optional\r\n\terr_txn1 := runner_txn1.Run(ops_txn1, id_txn1, nil)\r\n\r\n\tif err_txn1 != nil {\r\n\t\tfmt.Println(\"Error inserting parent and child: %v\", err_txn1.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\tparentObj.UpdatedDate = time.Now().UTC()\r\n\trunner_txn2 := txn.NewRunner(txnCollection)\r\n\tops_txn2 := []txn.Op{{\r\n\t\tC:      parentCollection,\r\n\t\tId:     parentObj.Id,\r\n\t\tUpdate: parentObj,\r\n\t}, {\r\n\t\tC:      childCollection,\r\n\t\tId:     childObj2.Id,\r\n\t\tInsert: childObj2,\r\n\t}}\r\n\tid_txn2 := bson.NewObjectId() // Optional\r\n\terr_txn2 := runner_txn2.Run(ops_txn2, id_txn2, nil)\r\n\r\n\tif err_txn2 != nil {\r\n\t\tfmt.Println(\"Error inserting child and updating parent: %v\", err_txn2.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\tfmt.Println(\"Successfully processed both transactions!\")\r\n}\r\n```"}}