I\'d like to have a single method that either creates or updates a document for a policy. Searching and trying different techniques like this one, I have come up with a nul
Thanks to JohnnyHK for a helpful answer above. I came up with a one-liner since it's used so frequently:
query = args._id ? { _id: args._id } : { _id: new ObjectId() };
It relies on the following require:
const ObjectId = require('mongodb').ObjectID;