Daniel W
unread,Jan 5, 2012, 10:43:30 AM1/5/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
I'm using pymongo, and I'm confused why this had the desired effect:
db.POV3.update({'_id':foo['_id']}, {'$pull': {'vhst': {u's': u'NY',
u'vtd': u'', u'd': datetime.datetime(2002, 1, 1, 0, 0), u't':
u'PRIM'}}})
...but this did not: ($pullAll instead of $pull, with the value to be
pulled put into an array)
db.POV3.update({'_id':foo['_id']}, {'$pullAll': {'vhst': [{u's':
u'NY', u'vtd': u'', u'd': datetime.datetime(2002, 1, 1, 0, 0), u't':
u'PRIM'}]}})
The relevant part of the document in mongo was:
"vhst" : [
{
"d" : ISODate("2002-01-01T00:00:00Z"),
"s" : "NY",
"t" : "GEN",
"vtd" : "X"
},
{
"d" : ISODate("2002-01-01T00:00:00Z"),
"s" : "NY",
"t" : "PRIM",
"vtd" : ""
},
{
"s" : "NY",
"vtd" : "X",
"d" : ISODate("2002-01-01T00:00:00Z"),
"t" : "PRIM"
}
],
thanks!