Problem Overview:
I'm querying a "Sessions" collection for sessions with a UserID == string, this works fine. But when I try and OrderBy("DateCreated", Desc) which is of type timestamp I get 0 results
What I've tried:
I've checked the DB and the property I'm using which is called "DateCreated" and it's a valid timestamp type. All sessions data is generated in go with random date ranges.
Current Results:
returns 100 results (correct)
firstSessionQuery := db.Collection("Sessions").Where("UserID", "==", uid).Documents(ctx)
returns 0 results VS 100 (incorrect)
firstSessionQuery := db.Collection("Sessions").Where("UserID", "==", uid).OrderBy("DateCreated", firestore.Asc).Documents(ctx)
firstSessionQuery := db.Collection("Sessions").Where("UserID", "==", uid)
allDocs, err := firstSessionQuery.Documents(ctx).GetAll()
docsSorted := firstSessionQuery.OrderBy("DateCreated", firestore.Asc).Documents(ctx)
allDocsSorted, err := docsSorted.GetAll()
fmt.Printf("docs len: %v, docs sorted len: %v
", len(allDocs), len(allDocsSorted))
the first %v returns 100, second %v returns 0
Expected results:
My expected results are 100 sessions sorted by date, either ascending or descending.
Here are db screenshots:
here is the DateCreated prop