So, inside a collection I have many documents, each document have embedded an array of documents, each of these documents inside the embedded array have many fields, among them, a "date time" field.
What I want to do is to get an array for a date range from such embedded array of documents, however I don't know how to do this. I'm using MongoDB 3.2.
I'm using the mgo driver for the Go programming language, but a mongo-shell example can work for me, too.
My non-working code:
documents := []Movement{}
m := mongo.DB(config.DB.Name).C("users")
// Hacemos la busqueda en la base de datos
m.Find(bson.M{"tuid": update.Message.From.ID, "movements": bson.M{"$gt": startdate, "$lte": enddate}}).All(&documents)