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

EJSON stringify support ignoreUndefined

      How are you using Mongo? What version of the server and driver are you using?

      Have a client-side application where I want to serialize raw data using the extended-json in order to send data to the backend. That data contains objects with explicit undefined values. I also may have a case where the data contains explicit null values

      {zig: "zag", foo: undefined, bar: null}
      

      What is the feature/improvement you would like?

      I would like to be able to serialize the above with EJSON.stringify to 

      {zig: "zag", bar: null}

      Ideally the EJSON options includes an `ignoreUndefined` property like the regular serialize function.

      What use case would this feature/improvement enable?

      More explicit intention in encoding/serializing with the EJSON API

      Current workaround is to have some singleton represent values I would actually want as null, and have a replacer handle converting them to null and excluding undefines.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tkutcher@outlook.com Timothy Kutcher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: