Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2162

MongoError: "$match with $text is only allowed as the first pipeline stage"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 3.3.2
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • MongoDB Version:
      4.0.7

      Description

      The code below produces the error "$match with $text is only allowed as the first pipeline stage", even though $match with $text is the only pipeline stage. Is there a subtle syntax error somewhere, or what else might be going on?

      const collectionChangeStream = collection.watch([
        { $match: { $text: { $search: 'cake' } } },
      ]);
       
      collectionChangeStream.on('change', next => {
        console.log(next);
      });
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              daniel.aprahamian Daniel Aprahamian (Inactive)
              Reporter:
              dandv Dan Dascalescu
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: