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 8687341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:05:40+00:00 2026-06-12T23:05:40+00:00

Basic question: Using Node.js I would like to get all the keys in my

  • 0

Basic question: Using Node.js I would like to get all the keys in my redis db. My redis db looks like this when I call keys *;

  1. aXF
  2. x9U
  3. lOk

So each record I have, has a unique key, generated as a random string. Now I would like to call something like foreach(key in Redis) and get all keys in the redis. Would it be possible to accomplish a “SELECT * FROM Redis”-like query with Node.js & Redis

  • 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-12T23:05:41+00:00Added an answer on June 12, 2026 at 11:05 pm

    Sure, you’ll need to install the redis module for nodejs which can be found at https://github.com/redis/node-redis.

    npm install redis
    

    Then you would do:

    var redis = require('redis'),
        client = redis.createClient();
    
    client.keys('*', function (err, keys) {
      if (err) return console.log(err);
       
      for(var i = 0, len = keys.length; i < len; i++) {
        console.log(keys[i]);
      }
    });        
    

    Generally speaking you won’t want to always return all of the keys (performance will be bad for larger data sets), but this will work if you are just testing things out. There is even a nice warning in the Redis documentation:

    Warning: consider KEYS as a command that should only be used in
    production environments with extreme care. It may ruin performance
    when it is executed against large databases. This command is intended
    for debugging and special operations, such as changing your keyspace
    layout. Don’t use KEYS in your regular application code. If you’re
    looking for a way to find keys in a subset of your keyspace, consider
    using sets.

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

Sidebar

Related Questions

This is a basic understanding concepts related question. Working using: Embarcadero C++ Builder What
Im using SVN for the first time, so probably this is a basic question.
I have a (hopefully) basic question on credit card processing, particularly using Authorize.Net. This
This might be a basic question: I am using a temporary table in some
This might be a basic question: I am using a temporary table in some
This may be a basic question but I am using HTML anchor, with the
This may be a basic question but I am using app engine in eclipse
I am new to using XPath and this may be a basic question. Kindly
I know this is a basic question, but I just started using Cygwin and
This is a basic jQuery question - I'm using the spinbox plugin, here: http://dev.jtsage.com/jQM-Spinbox/

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.