Date comparisons don't work?

I’m obviously missing something very obvious. Why doesn’t this query return the records where time1 < time2?

db.dtest4.insertMany([{
    "time1" : ISODate("2021-01-23T23:05:36.910Z"),
    "time2" : ISODate("2021-01-24T00:05:48.339Z")
}
,{
    "time1" : ISODate("2021-01-26T20:03:13.344Z"),
    "time2" : ISODate("2021-01-24T00:05:48.339Z")
}
,{
    "time1" : ISODate("2021-01-23T23:05:49.339Z"),
    "time2" : ISODate("2021-01-24T00:05:48.339Z")
}
,{
    "time1" : ISODate("2021-01-23T23:04:12.710Z"),
    "time2" : ISODate("2021-01-24T00:05:48.339Z")
}
,{
    "time1" : ISODate("2021-01-24T01:26:58.906Z"),
    "time2" : ISODate("2021-01-24T00:05:48.339Z")
}]);

db.dtest4.find({time1: {"$lt": "$time2"}});

Returns:

/* 1 */
{
    "acknowledged" : true,
    "insertedIds" : [ 
        ObjectId("60117e8292324b130b58f5f1"), 
        ObjectId("60117e8292324b130b58f5f2"), 
        ObjectId("60117e8292324b130b58f5f3"), 
        ObjectId("60117e8292324b130b58f5f4"), 
        ObjectId("60117e8292324b130b58f5f5")
    ]
}

Fetched 0 record(s) in 3ms

I think you cannot compare 2 fields together with the simple syntax. Try with $expr:

> db.dtest4.find({"$expr": { "$lt" : [ "$time1" , "$time2" ] }});
{ "_id" : ObjectId("6011c0934b17c80f1720f498"), "time1" : ISODate("2021-01-23T23:05:36.910Z"), "time2" : ISODate("2021-01-24T00:05:48.339Z") }
{ "_id" : ObjectId("6011c0934b17c80f1720f49a"), "time1" : ISODate("2021-01-23T23:05:49.339Z"), "time2" : ISODate("2021-01-24T00:05:48.339Z") }
{ "_id" : ObjectId("6011c0934b17c80f1720f49b"), "time1" : ISODate("2021-01-23T23:04:12.710Z"), "time2" : ISODate("2021-01-24T00:05:48.339Z") }

Thanks steeve!

It seems like the “simple syntax” only works with constants as arguments. I tried this too: db.dtest4.find({time1: {lt: {subtract:{[ISODate("2021-01-24T00:05:48.339Z"),3600000]}}}) and it also returns no records, but the $expr version works. Is this limitation documented somewhere?

Thanks again for your help!