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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:43:23+00:00 2026-05-17T06:43:23+00:00

I want to perform a LIKE-condition (SQL syntax) in CouchDB. How can this be

  • 0

I want to perform a LIKE-condition (SQL syntax) in CouchDB. How can this be done? The LIKE-condition will be used to perform auto complete in the browser.

I want to write “co” in the input field and get the results Coffee, Couch, CouchDB ect.

  • 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-05-17T06:43:24+00:00Added an answer on May 17, 2026 at 6:43 am

    It is very easy to search for letters at the beginning of a string. You just need a view that emits the string you want to search for as the key. Assuming the user input is stored in a variable q, you then call that view with the parameters startkey=q and endkey=q+"\ufff0".

    The trick here is to append the highest possible Unicode character to the search string. In the sort order, this string comes after anything else starting with q. (This is much easier to implement than the solution suggested by @titanoboa, where you need to “increment” the last letter of the user input.)

    If you also want to be able to find words in the middle of a string (e.g. “The Colbert Report” when typing “co”), you could use a view like this:

    function(doc) {
      if (doc.title) {
        var words = {};
        doc.title.replace(/\w+/g, function(word) {
          words[word.toLowerCase()] = true;
        });
        for (w in words) {
          emit(w, doc);
        }
      }
    }
    

    Of course this is only advisable for short strings. For searching in longer texts you should look into a full-text search add-on like couchdb-lucene.

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

Sidebar

Related Questions

i want to perform analysis on SQL code. In this i would like to
I want to perform a simple query like this in my PHP, SELECT noslots
Say I want to write a function like this: int get_some_int(string index) { ...perform
I want to perform a conditional right join in this SQL SELECT * FROM
I want to perform a LIKE style comparison with an IN operator e.g.: select
Example: I have some text, like this php code if(empty($condition)) { // work here...
I'm using a TableViewer and I want to it perform like when I hold
I have a Linq-to-SQL class, and I'd like to perform some pre-save validation before
I want perform a easy task in android, which when receiving a call the
I want to perform an jquery request to php and then I want php

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.