Mongodb for NumberLong()

Find record by some key that’s saved with int64 this in go?
Stored in database as -> “iid” : NumberLong(4749861583195795091)
db.items.find({iid: NumberLong(‘84810959494203780’)})

I’ve tried :
(bson.D{{Name: “iid”, Value: “NumberLong(‘84810959494203780’)”}})
(bson.D{{Name: “iid”, Value: “84810959494203780”}})
(bson.D{{Name: “iid”, Value: 84810959494203780}})

All 3 solution was not able to find the record to delete

Resolved… Problem wasn’t the delete.
(bson.D{{Name: “iid”, Value: iid}}) This should work fine.
Needed to add tag json:"IID,string" to the struct. So that the it could be marshaled accordingly. Did not realize my list function returned a different value of iid in the front end.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.