codediodeio / geofirex

:globe_with_meridians: :round_pushpin: Geolocation Queries with Firestore & RxJS

Home Page:https://geo-test-c92e4.firebaseapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compound query with != operator always returning 0 documents

coddamn opened this issue · comments

commented

I want to track users nearby where 'userId' != this.myUserid.
but the query doesn't return the result expected
this is the code I am running :

const userRef = firestore().collection('users').where('userId','!=',this.uid).orderBy('userId');
      const usersRef = firestore().collection("users");
      this.watch = Plugins.Geolocation.watchPosition(
        { maximumAge: 0, timeout: 5000 },
        (geoPosition) => {
          if (geoPosition) {
            console.log(geoPosition);
            const field = "position";
           
            const center = this.geo.point(geoPosition.coords.latitude,geoPosition.coords.longitude);
           
            const position = this.geo.point(
              geoPosition.coords.latitude,
              geoPosition.coords.longitude
            );
          
            
            usersRef.doc(this.uid).set({ position }, { merge: true });
            this.points = this.radius.pipe(
              switchMap((r) => {
                return this.geo.query(userRef).within(center, r, field, {log: true});
              }),
              shareReplay(1)
            );
          }
        }
      );