0

I need to simply compare two numbers with each other, both in the same document. All rows have end times that are larger than their start times.

My question is are we even able to compare values in this fashion in a find query, if yes then what could be the cause of this not working?

mDB.collection("notifications").find({end_time: {$gt:"$start_time"}}).toArray()

I want to at all costs avoid running JS. Mongo version: 3.4.6-0

ThatBrianDude
  • 2,952
  • 3
  • 16
  • 42
  • 1
    Possible duplicate of [MongoDb query condition on comparing 2 fields](https://stackoverflow.com/questions/4442453/mongodb-query-condition-on-comparing-2-fields) – Lix Aug 24 '17 at 13:30
  • I cant seem to find the anwser to my question: can I compare these two fields with a simple find query? – ThatBrianDude Aug 24 '17 at 13:37
  • 1
    No, you can not do this at the moment with a simple query. What is your use case. Do not ask for a specific solution, describe your use case and your problem – Markus W Mahlberg Aug 24 '17 at 15:06
  • I didnt need to as that is exactly what I wanted to know. Thank you for your reply – ThatBrianDude Aug 24 '17 at 15:11

0 Answers0