Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-8701

Comment on: "manual/reference/operator/query/text.txt"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual, Server

    Description

      Could someone confirm the following strange behavior with MongoDB 3.2.9:
      I have used the sample with db.articles collection at this location:
      https://docs.mongodb.com/manual/reference/operator/query/text/

      If you don't want to find the exact sample on MongoDB site, you could simply do the following:

      db.articles.createIndex(

      { subject: "text" }

      )
      db.articles.insert(

      { _id: 1, subject: "coffee", author: "xyz", views: 50 }

      )
      db.articles.insert(

      { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }

      )
      db.articles.insert(

      { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }

      )
      db.articles.insert(

      { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }

      )

      When I type:
      db.articles.find( { $text:

      { $search: "coffee" }

      } )

      it correctly finds 3 records.

      Now add a new document with:
      db.articles.insert({_id: 9, subject: "something", author: "whatever", views: 100})

      and try to find it with:
      db.articles.find( { $text:

      { $search: "something" }

      } )

      • the document is found.

      Now add a new document with:
      db.articles.insert({_id: 10, subject: "more", author: "whatever", views: 100})

      Now try to find that document with:
      db.articles.find( { $text:

      { $search: "more" }

      } )

      Unfortunately, the document is not found. I'm afraid that this could be a sign for bigger problems in MongoDB text searching.

      gogox@yahoo.com

      Attachments

        Activity

          People

            Unassigned Unassigned
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago