I'm trying to remove a bunch of documents that have a common attribute. This is what a document looks like:
{
_id : {
attr1 : 'foo',
attr2 : 'bar'
},
attr3 : 'baz',
}
More than one document will have the same 'foo' value in the attr1 entry. I'm trying to remove all of those. For that I've got something similar to this:
type DocId struct {
Attr1 string `bson:"attr1,omitempty"`
Attr2 string `bson:"attr2,omitempty"`
}
type Doc struct {
Id DocId `bson:"_id,omitempty"`
Attr3 string `bson:"attr3,omitempty"`
}
doc := Doc{
Id : DocId{ Attr1 : 'foo' },
}
collection := session.DB("db").C("collection")
collection.Remove(doc)
The problem here is that I'm getting a Not found
error in the remove call.
Can you see anything odd in the code?
Thanks a lot!