I have an element that looks like this:
{"Name":"test name","DBType":0,"UserName":"test user","Password":"","Host":"test host","Port":"123","DBName":"test schema","Options":"test options","Groups":["test1"]}
I want to be able to query the cataloug of Datasources for those which are assigned to a particular group.
My code for this is:
var d []Source
q := bson.M{"Groups": bson.M{"$in": [1]string{groupName}}}
findErr := c.Find(q).All(&d)
However - I get no error and no results.
I've also tried
q := bson.M{"Groups": groupName}
with the same result.
//Source describes a data source
type Source struct {
Name string
DBType uint
UserName string
Password string
Host string
Port string
DBName string
Options string
Groups []string
}
I'm stuck - I am puzzled! Any help appreciated.
Update - I tried
{"Name":"test name"}
and this returns 0 items. Yet if I set to nil I get stuff.