Question 1>
I still can’t clearly tell the difference between using the $and operator and “,”
Can anyone tell me the difference between the three sentences below?
Method1: Didn’t work
db.trips.find({
tripduration: null, tripduration: { $exists: true }
}); // Doesn't work,
Method2: works!
db.trips.find({
tripduration: { $exists: true, $eq: null }
})
Method3: Works!
db.trips.find({
$and: [{ tripduration: null }, { tripduration: { $exists: true } }]
})
And if the fields in the query are different, just comma(1st try method) seems to be enough.
db.trips.find({ **//Works!**
"start station id" : 279,
"start station name" : "Peck Slip & Front St",
"bikeid" : 16118,
})
Is method 2 and method 3 used when field names are same?