Niko
Niko

Reputation: 25

mongo query with and operator

in my meteor app I am trying to count the number of collection-items based on two fields, without success:

importantTilDatesCount: Entrys.findFromPublication('importantEntrys', { $and: [
    {"importantType" : { true }},
    {"importantDate" : { 
      $lt: new Date(new Date().setDate(new Date().getDate()+7))
    }} 
  ]
}).count(),

"Entrys" is no typo ;)

Upvotes: 1

Views: 52

Answers (1)

Niko
Niko

Reputation: 25

Thanks, it was both. true instead of { true }, as well as not specifying $and.

Upvotes: 0

Related Questions