sailaja m
sailaja m

Reputation: 129

Parse query to get count of records by month and year using parse javascript sdk

I am trying to retrieve count of rows from parse object by month and year to show analytics by month. I am new to parse sdk and have no idea how to query based on month and year. Please help me in this.

Upvotes: 0

Views: 443

Answers (1)

ChunTingLin
ChunTingLin

Reputation: 970

monthStart/monthEnd/yearStart/yearEnd is Date

var m_query = new Parse.Quer("COLLECTION");
m_query.greaterThan('createdAt', monthStart);
m_query.lessThan('createdAt', monthEnd);
m_query.count().then(num=> console.log(num));

var y_query = new Parse.Quer("COLLECTION");
y_query.greaterThan('createdAt', yearStart);
y_query.lessThan('createdAt', yearEnd);
y_query.count().then(num=> console.log(num));

Upvotes: 1

Related Questions