{"record":{"id":"1fc2ac0f35bc3cfd","repo":"mongodb/mongoid","slug":"multiple-text-expressions-per-query-are-not-curre","errorCode":null,"errorMessage":"Multiple $text expressions per query are not currently supported by the server","messagePattern":"Multiple \\$text expressions per query are not currently supported by the server","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/mongoid/criteria/queryable/selectable.rb","lineNumber":743,"sourceCode":"        # @param [ String | Symbol ] terms A string of terms that MongoDB parses\n        #   and uses to query the text index.\n        # @param [ Hash ] opts Text search options. See MongoDB documentation\n        #   for options.\n        #\n        # @return [ Selectable ] The cloned selectable.\n        def text_search(terms, opts = nil)\n          raise Errors::CriteriaArgumentRequired, :terms if terms.nil?\n\n          clone.tap do |query|\n            criterion = { '$text' => { '$search' => terms } }\n            criterion['$text'].merge!(opts) if opts\n            if query.selector['$text']\n              # Per https://www.mongodb.com/docs/manual/reference/operator/query/text/\n              # multiple $text expressions are not currently supported by\n              # MongoDB server, but build the query correctly instead of\n              # overwriting previous text search condition with the currently\n              # given one.\n              Mongoid.logger.warn('Multiple $text expressions per query are not currently supported by the server')\n              query.selector = { '$and' => [ query.selector ] }.merge(criterion)\n            else\n              query.selector = query.selector.merge(criterion)\n            end\n          end\n        end\n\n        # This is the general entry point for most MongoDB queries. This either\n        # creates a standard field: value selection, and expanded selection with\n        # the use of hash methods, or a $where selection if a string is provided.\n        #\n        # @example Add a standard selection.\n        #   selectable.where(name: \"syd\")\n        #\n        # @example Add a javascript selection.\n        #   selectable.where(\"this.name == 'syd'\")\n        #\n        # @param [ [ Hash | String ]... ] *criterion The standard selection","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/criteria/queryable/selectable.rb#L725-L761","documentation":"Error \"Multiple $text expressions per query are not currently supported by the server\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/criteria/queryable/selectable.rb:743 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}