How to query Date $gte in meteor on a mongodb collection?

188 Views Asked by At

I have the following objects in a MEC_CALENDAR_DATES collection. My aim is to query the documents in this collection from a Meteor project greater than or equal to a start date property Date:

{
    "_id" : "vT92uJzbiDheH4FYD",
    "key" : "MEC_CALENDAR_DATES",
    "Title" : "BBS",
    "Date" : ISODate("2017-11-21T00:00:00.000Z")
}

/* 2 */
{
    "_id" : "seGmNdwfQxTJnTxJz",
    "key" : "MEC_CALENDAR_DATES",
    "Title" : "AAS",
    "Date" : ISODate("2017-11-15T00:00:00.000Z")
}

What I've tried in RoboMongo is the following query which works and returns the objects greater than the supplied date for that collection:

db.getCollection('app_configuration').find({"key":"MEC_CALENDAR_DATES", "Date": {$gte: ISODate("2017-10-03T09:35:14.561Z")}}).sort({Date: -1})

But when I try to translate that to Meteor using the api zero results are returned:

const appConfigCollection = AppConfiguration.find({
  key: "MEC_CALENDAR_DATES",
  Date: {$gte:ISODate("2017-08-03T10:26:13.151Z")},
},
  {
    sort: {Date: -1},
});

console.log("appConfigCollection " + appConfigCollection);

Question:

How can you query documents $gte using Meteor api on a collection?

0

There are 0 best solutions below