I need to search documents from a collection based upon datetime i.e using $lt and $gt, I am storing date in this format ISODate("2015-12-31T06:45:49.832Z")
str := r.FormValue("date")
t, err1 := time.Parse(time.RFC3339, str)
iter := uc.session.DB("dbname").C("posts").Pipe([]bson.M{bson.M{"$match": bson.M{"rupdatedon": bson.M{"$lt": t}}},
{"$lookup": bson.M{"from": "users", "localField": "userid", "foreignField": "_id", "as": "user_details"}},
bson.M{"$sort": bson.M{"rupdatedon": 1}},
bson.M{"$limit": l}}).Iter()
but the results that I am getting are based upon date and not time. i.e if i search for documents which are less than rupdatedon (2015-12-31T06:45:49.832Z) I get all the results for 31-12-2015.
Sorry for bothering you guys again, but need help with this.