Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:41:48+00:00 2026-06-07T19:41:48+00:00

From the Transactions doc, second paragraph: The intention here is for the client to

  • 0

From the Transactions doc, second paragraph:

The intention here is for the client to increment the total number of
chat messages sent (ignore for a moment that there are better ways of
implementing this).

What are some standard “better ways” of implementing this?

Specifically, I’m looking at trying to do things like retrieve the most recent 50 records. This requires that I start from the end of the list, so I need a way to determine what the last record is.

The options as I see them:

  • use a transaction to update a counter each time a record is added, use the counter value with setPriority() for ordering
  • forEach() the parent and read all records, do my own sorting/filtering at client
  • write server code to analyze Firebase tables and create indexed lists like “mostRecent Messages” and “totalNumberOfMessages”

Am I missing obvious choices?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:41:49+00:00Added an answer on June 7, 2026 at 7:41 pm

    To view the last 50 records in a list, simply call “limit()” as shown:

    var data = new Firebase(...);
    data.limit(50).on(...);
    

    Firebase elements are ordering first by priority, and if priorities match (or none is set), lexigraphically by name. The push() command automatically creates elements that are ordered chronologically, so if you’re using push(), then no additional work is needed to use limit().

    To count the elements in a list, I would suggest adding a “value” callback and then iterating through the snapshot (or doing the transaction approach we mention). The note in the documentation actually refers to some upcoming features we haven’t released yet which will allow you to count elements without loading them first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count the number of transactions which retrieves some reports from database
I am testing whether option from app.config listed below Is applied to all transactions
There seem to be very different opinions about using transactions for reading from a
If SELECT SUM(amount) FROM transactions ORDER BY order LIMIT 0, 50 sums the amount
I want to [update] the transaction_id from transactions table into the cmas table but
<?php $transactionOutput = ; $sql = mysql_query(SELECT * FROM transactions WHERE emailaddress='$email'); $productCount =
SELECT user_id, investments, expenditures FROM ( SELECT user_id, SUM(amount) investments FROM transactions where beneficiary_id
I have the following query which obtains transactions from the transactions table and transaction
Here is a query that groups transactions by pricepoint on an hourly basis: SELECT
I want to get the total from amount where charity is 0 minus a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.