How to use both where and orderBy filters in firestore [duplicate]Firestore whereEqualTo, orderBy and limit(1) not workingWhy does this firestore query require an index?What is the best way to filter a Java Collection?Filtering for empty or NULL names in a querysetlist comprehension vs. lambda + filterHow to design RESTful search/filtering?Firebase WEB - Email Verification not being sent. What's wrong with the codeWhat's the difference between Cloud Firestore and the Firebase Realtime Database?What is firestore Reference data type good for?Firestore query subcollectionsWhy Does My Firebase HTTPS Function Go Silent When I Try to Save to Firestore?Firebase Firestore - Query for posts in a big collection where groupId should match a value in an array

When calculating averages, why can we treat exploding die as if they're independent?

Was Robin Hood's point of view ethically sound?

How should we understand "unobscured by flying friends" in this context?

Distinguishing between octahedral and tetrahedral holes

Can you pop microwave popcorn on a stove?

If every star in the universe except the Sun were destroyed, would we die?

How should Thaumaturgy's "three times as loud as normal" be interpreted?

Features seen on the Space Shuttle's solid booster; what does "LOADED" mean exactly?

Strategies for dealing with chess burnout?

Lost & Found Mobile Telepone

More than three domains hosted on the same IP address

Why is it that I have to play this note on the piano as A sharp?

How is lower/no gravity simulated on a planet with gravity, without leaving the surface?

Problem with listing a directory to grep

Does the word voltage exist in academic engineering?

How to set any file manager in Linux to show the duration like the Length feature in Windows Explorer?

Supervisor wants me to support a diploma-thesis software tool after I graduated

Is future tense in English really a myth?

Yet another calculator problem

Is every sentence we write or utter either true or false?

Methods and Feasibility of Antimatter Mining?

How to find a reviewer/editor for my paper?

What can we do about our 9-month-old putting fingers down his throat?

Electric shock from pedals and guitar. Jacks too long?



How to use both where and orderBy filters in firestore [duplicate]


Firestore whereEqualTo, orderBy and limit(1) not workingWhy does this firestore query require an index?What is the best way to filter a Java Collection?Filtering for empty or NULL names in a querysetlist comprehension vs. lambda + filterHow to design RESTful search/filtering?Firebase WEB - Email Verification not being sent. What's wrong with the codeWhat's the difference between Cloud Firestore and the Firebase Realtime Database?What is firestore Reference data type good for?Firestore query subcollectionsWhy Does My Firebase HTTPS Function Go Silent When I Try to Save to Firestore?Firebase Firestore - Query for posts in a big collection where groupId should match a value in an array






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0
















This question already has an answer here:



  • Why does this firestore query require an index?

    2 answers



  • Firestore whereEqualTo, orderBy and limit(1) not working

    1 answer



Its working fine
firebase.firestore().collection('Location').orderBy("syncedAt", "desc").get()



its also working fine
firebase.firestore().collection('Location').where('email', '==', email).get()



but using both orderBy and where not working



getUserPastInformation = async (email) => 
this.Location = firebase.firestore().collection('Location').orderBy("syncedAt", "desc").where('email', '==', email)
await this.Location.limit(10).get().then(res =>
let locationHistory = []
this.setState( lastData: res._docs[res._docs.length - 1]._data.syncedAt )
res.docs.forEach(element =>
locationHistory.push(element.data())

);
const data = locationHistory.sort((a, b) => Moment(b.syncedAt).unix() - Moment(a.syncedAt).unix());
if (res.docs.length > 0)
this.setState(
locationHistory: data,
loader: false
)

).catch(err =>
console.log('err----->>>', err)
);










share|improve this question














marked as duplicate by Alex Mamo firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 28 at 10:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

    – Mohamed Omar
    Mar 28 at 7:41


















0
















This question already has an answer here:



  • Why does this firestore query require an index?

    2 answers



  • Firestore whereEqualTo, orderBy and limit(1) not working

    1 answer



Its working fine
firebase.firestore().collection('Location').orderBy("syncedAt", "desc").get()



its also working fine
firebase.firestore().collection('Location').where('email', '==', email).get()



but using both orderBy and where not working



getUserPastInformation = async (email) => 
this.Location = firebase.firestore().collection('Location').orderBy("syncedAt", "desc").where('email', '==', email)
await this.Location.limit(10).get().then(res =>
let locationHistory = []
this.setState( lastData: res._docs[res._docs.length - 1]._data.syncedAt )
res.docs.forEach(element =>
locationHistory.push(element.data())

);
const data = locationHistory.sort((a, b) => Moment(b.syncedAt).unix() - Moment(a.syncedAt).unix());
if (res.docs.length > 0)
this.setState(
locationHistory: data,
loader: false
)

).catch(err =>
console.log('err----->>>', err)
);










share|improve this question














marked as duplicate by Alex Mamo firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 28 at 10:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

    – Mohamed Omar
    Mar 28 at 7:41














0












0








0









This question already has an answer here:



  • Why does this firestore query require an index?

    2 answers



  • Firestore whereEqualTo, orderBy and limit(1) not working

    1 answer



Its working fine
firebase.firestore().collection('Location').orderBy("syncedAt", "desc").get()



its also working fine
firebase.firestore().collection('Location').where('email', '==', email).get()



but using both orderBy and where not working



getUserPastInformation = async (email) => 
this.Location = firebase.firestore().collection('Location').orderBy("syncedAt", "desc").where('email', '==', email)
await this.Location.limit(10).get().then(res =>
let locationHistory = []
this.setState( lastData: res._docs[res._docs.length - 1]._data.syncedAt )
res.docs.forEach(element =>
locationHistory.push(element.data())

);
const data = locationHistory.sort((a, b) => Moment(b.syncedAt).unix() - Moment(a.syncedAt).unix());
if (res.docs.length > 0)
this.setState(
locationHistory: data,
loader: false
)

).catch(err =>
console.log('err----->>>', err)
);










share|improve this question















This question already has an answer here:



  • Why does this firestore query require an index?

    2 answers



  • Firestore whereEqualTo, orderBy and limit(1) not working

    1 answer



Its working fine
firebase.firestore().collection('Location').orderBy("syncedAt", "desc").get()



its also working fine
firebase.firestore().collection('Location').where('email', '==', email).get()



but using both orderBy and where not working



getUserPastInformation = async (email) => 
this.Location = firebase.firestore().collection('Location').orderBy("syncedAt", "desc").where('email', '==', email)
await this.Location.limit(10).get().then(res =>
let locationHistory = []
this.setState( lastData: res._docs[res._docs.length - 1]._data.syncedAt )
res.docs.forEach(element =>
locationHistory.push(element.data())

);
const data = locationHistory.sort((a, b) => Moment(b.syncedAt).unix() - Moment(a.syncedAt).unix());
if (res.docs.length > 0)
this.setState(
locationHistory: data,
loader: false
)

).catch(err =>
console.log('err----->>>', err)
);





This question already has an answer here:



  • Why does this firestore query require an index?

    2 answers



  • Firestore whereEqualTo, orderBy and limit(1) not working

    1 answer







firebase filter google-cloud-firestore






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 7:37









Jomi MosesJomi Moses

33 bronze badges




33 bronze badges





marked as duplicate by Alex Mamo firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 28 at 10:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











marked as duplicate by Alex Mamo firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 28 at 10:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Alex Mamo firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 28 at 10:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

    – Mohamed Omar
    Mar 28 at 7:41


















  • Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

    – Mohamed Omar
    Mar 28 at 7:41

















Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

– Mohamed Omar
Mar 28 at 7:41






Would you mind swapping it around where and order by and let me know what happens? If not then you might have to retrieve the collection and then apply the next function on your previous result

– Mohamed Omar
Mar 28 at 7:41













0






active

oldest

votes














0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.





Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript