4
Currently I use firebase as my database. I need to take a collection and bring the data of a specific month according to two fields of my collection. firebase doesn’t let us make querys with different fields so I chose to bring everything from the year 2018 and filter in my array the specific month.
I do the following query in firebase:
let start = new Date('2018-01-01');
let end = new Date('2018-12-31');
let ref = db.collection('eventos').where("dt_inicio", ">", start).where("dt_inicio", "<", end).orderBy("dt_inicio", "asc");
ref.get()
.then(function (querySnapshot) {
querySnapshot.forEach(function (doc) {
console.log(doc.data());
});
});
It returns me to doc.data(), and giving a console.log I get the following return.
I would like to filter the start date and end date by the month of 08/2018.
How should I proceed?
I think what he wants is to filter directly.
– NoobSaibot
Firebase doesn’t allow it. https://firebase.google.com/docs/firestore/query-data/queries#compound_queries
– João Pedro Henrique