How do I find out inserted document's _id after running insertOne with forceServerObjectId set to true?

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.3.2
    • Component/s: None
    • Environment:
      Windows, Server running on Amazon Linux.
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Just running something like:

      let insertResults = await collection
          .insertOne({test: true}, {forceServerObjectId: true});
      

      _id isn't being added to the document (which is expected), but it also can't be found nowhere in insertResults. Would expect it in insertedId, but it's set to null.

      Am I doing something wrong?

            Assignee:
            Daniel Aprahamian (Inactive)
            Reporter:
            Ivan Filimonov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: