angular - AngularFire2 orderByKey and startAt -


i have following database structure:

{  "users" : {     "ap1-axlksd9aslkdjj0991" : {       "enabled" : true,       "color" : "red"     },     "ap1-a778asduasdj8as8da" : {       "enabled" : true,       "color" : "blue"     },     "ap2-asd88asd8asd8has8d" : {       "enabled" : true,       "color" : "red"     }   } } 

i'm trying users have key starting "ap1-" follows:

import { injectable } '@angular/core';  import { angularfiredatabase, firebaselistobservable } 'angularfire2/database';  import * firebase 'firebase/app';  import { observable } 'rxjs/observable';  @injectable() export class firebaseservice {     //     // database     userlist: firebaselistobservable<any>;      public constructor(         public afdb: angularfiredatabase) {     }      getusers() {         return this.userlist = this.afdb.list('/users', {             preservesnapshot: true,             query: {                 orderbykey: true,                 startat: 'ap1-'             }          });     } } 

the above code however, returns ap1- , ap2- keys. i'm searched online , cannot find way achieve this.

i tried equalto.. when put in exact correct key, finds this. when put in nonsense key finds nothing.

it seems there's bug in startat?

you cannot firebase that. 'startswith' retrieve keys 'ap1-' , above, not strings have 'ap1-' first characters.

if had following keys

{"1", "2", "3", "4"} 

and queried

startswith: "3" 

then get

{ "3", "4" } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -