I'm trying to do a query in mongo that basically will be...Get all documents that match this instance Id AND where the status does not equal Deleted or Rejected. I figured out how to do this in mongodb query but I'm having an issue translating it to golang mgo.
This is the mongodb query:
db.getCollection('instance_documents').find( {"$and":[
{ "status": {"$nin":['DELETED', "REJECTED"] }},
{"_id": “instanceID”}
]
})
This is what I've tried so far in golang, the query does not work properly, it returns nothing:
err := appInstanceCollection.Find(bson.M{
"$and": []bson.M{
{"status": bson.M{"$nin": []string{"REJECTED", "DELETED"}}},
{"_id": instanceID},
},
}).One(&instance)
instancestruct have it's tags set up properly?