You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firebase allows you to do ad-hoc queries on your data using an arbitrary child key. If you know in advance what your indexes will be, you can define them via the .indexOn rule in your Firebase Realtime Database Security Rules to improve query performance.
Indexes are not required for development unless you are using the REST API.
So why am I receiving Index not defined, add ".indexOn": "pNumber", for path "/things", to the rules
when the getOrderedByNumber callback is executed ?
Note that this also occurs with the emulator attached.
Steps and code to reproduce issue
export function DemoFiltering() {
const rtb = useRTB();
const thingsListRef = ref(rtb, "things");
const orderByNumber = orderByChild("pNumber");
const getOrderedByNumber = useCallback(
async (constraint: QueryConstraint | undefined, info: string) => {
let snapshot: DataSnapshot;
let orderByNumberQuery: Query;
try {
if (constraint) {
orderByNumberQuery = query(thingsListRef, constraint, orderByNumber);
} else {
orderByNumberQuery = query(thingsListRef, orderByNumber);
}
snapshot = await get(orderByNumberQuery);
} catch (reason) {
// `Index not defined, add ".indexOn": "pNumber", for path "/things", to the rules`
}
//.other code
The text was updated successfully, but these errors were encountered:
I will debug the server code to be sure that the error has come from there. If it has the question is why is it throwing when the docs state that we may index.
Operating System
Windows 11
Environment (if applicable)
Version 128.0.6613.115 (Official Build) (64-bit)
Firebase SDK Version
^10.12.2
Firebase SDK Product(s)
Database
Project Tooling
React, typescript, parcel
Detailed Problem Description
I am iterating over a realtime database schema.
According to https://firebase.google.com/docs/database/security/indexing-data
So why am I receiving
Index not defined, add ".indexOn": "pNumber", for path "/things", to the rules
when the getOrderedByNumber callback is executed ?
Note that this also occurs with the emulator attached.
Steps and code to reproduce issue
The text was updated successfully, but these errors were encountered: