Query the tuples that exist in the source_id attribute
db.getCollection('database name').find({source_id:{$exists:true}})
db.getCollection(‘mqtt_log’).find({source_id:{$exists:true}})
Query the tuple whose source_id attribute is a specific value
db.getCollection(‘api_log’).find({source_id:“777779014”})
Query tuples where the source_id attribute exists and create_time is in a certain period of time
db.getCollection('database name').find({source_id:, {$exists:true}
create_time: {$gte: ISODate("2021-01-01T00:00:00Z"),$lte: ISODate("2021-01-28T00:00:00Z")}
})
db.getCollection(‘api_log’).find({source_id:“777779014”, create_time:{$gte: ISODate("2021-01-01T00:00:00Z"),$lte: ISODate("2021-01-28T00:00:00Z")}
})
db.getCollection(‘mqtt_log’).find({source_id:“1144606801”, create_time:{$gte: ISODate("2021-01-01T00:00:00Z"),$lte: ISODate("2021-01-28T00:00:00Z")}
})