[DOCS-16530] The example needs to be updated or correct informations needs to be added Created: 06/Dec/23  Updated: 05/Feb/24  Resolved: 31/Jan/24

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_[20240205]

Type: Task Priority: Minor - P4
Reporter: Aasawari Sahasrabuddhe Assignee: Caleb Thompson
Resolution: Done Votes: 0
Labels: Onboarding, backlog, bug
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

URL(s): https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/specify-language-text-index/create-text-index-multiple-languages/#results
Participants:
Days since reply: 1 week, 1 day ago

 Description   

The example in the documentation https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/specify-language-text-index/create-text-index-multiple-languages/#results needs to updated as the it does not contain information that the  default_language is set to English by default. 

If user wishes to use the example as given in the above doc, the index needs to be set as:

db.quotes.createIndex( { original: "text", "translation.quote": "text" , "default_language": "fr"} )

If the default_language is not specified, the query needs to be altered as:

 

Atlas atlas-xp4gev-shard-0 [primary] test> db.quotes.find( { $text: { $search: "réalité" , $language: "fr" }} )
[
  {
    _id: 2,
    language: 'spanish',
    original: 'Nada hay más surrealista que la realidad.',
    translation: [
      {
        language: 'english',
        quote: 'There is nothing more surreal than reality.'
      },
      {
        language: 'french',
        quote: "Il n'y a rien de plus surréaliste que la réalité."
      }
    ]
  }
]
 

 



 Comments   
Comment by Caleb Thompson [ 30/Jan/24 ]

https://github.com/10gen/docs-mongodb-internal/pull/6081

Comment by Aasawari Sahasrabuddhe [ 06/Dec/23 ]

This ticket has been created from the community post 
https://www.mongodb.com/community/forums/t/search-for-documents-in-the-collection-containing-multiple-languages/256346

 

Generated at Thu Feb 08 08:15:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.