Query MongoDB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
db.getCollection('logs').find({
  "datetime" : {
    $lt: new Date(),
    $gte: new Date(new Date().setDate(new Date().getDate()-1))
  }  
})

db.getCollection('plocsec_capacity').find(
{$and: [
      {plocsecid:338},
      {capacity:{$ne:null}},
      { $or: [ { start_date: { $eq: null } }, { start_date: {$lt: new Date(1630468740000)} } ] },
      { $or: [ { end_date: { $eq: null } },   { end_date:   {$gt: new Date(1630347946844)} } ] }
]})

db.getCollection('payments').find(
{$and: [
      { $and: [ { creation_date: { $ne: null } }, { creation_date: {$gt: new ISODate("2023-11-05T00:00:00Z")} } ] },
      { $and: [ { creation_date: { $ne: null } }, { creation_date: {$lt: new ISODate("2023-11-06T00:00:00Z")} } ] },
      {amount: {$gt:0}},
      {payment_type_code: {$ne:'NONE'}},
      {payment_type_code: {$ne:'BILA'}}
]}).count()