sample_app/lib/authorization_request_registrar_module/index.js
function post_authorization_request(authorization_request) {
    return new Promise((resolve, reject) => {
        dbMgr
            .updateOne("authorization_request", {
                client_id: {
                    $eq: null
                }
            }, {
                $set: authorization_request
            }, {upsert: true})
            .then((result) => {
                if (result.upsertedCount === 1) {
                    return resolve(result.upsertedId._id);
                } else {
                    return reject(new Error("No authorization recoreds inserted"));
                }
            }, (err) => {
                reject(err);
            });
    });
}
function post_authorization_request(authorization_request) {
    return new Promise((resolve, reject) => {
        dbMgr
            .updateOne("authorization_request", {
                client_id: {
                    $eq: null
                }
            }, {
                $set: authorization_request
            }, {upsert: true})
            .then((result) => {
                if (result.upsertedCount === 1) {
                    return resolve(result.upsertedId._id);
                } else {
                    return reject(new Error("No authorization recoreds inserted"));
                }
            }, (err) => {
                reject(err);
            });
    });
}
function post_authorization_request ( authorization_request ) { return new Promise ( ( resolve , reject ) => { dbMgr . updateOne ( "authorization_request" , { client_id : { $eq : null } } , { $set : authorization_request } , { upsert : true } ) . then ( ( result ) => { if ( result . upsertedCount === 1 ) { return resolve ( result . upsertedId . _id ) ; } else { return reject ( new Error ( "No authorization recoreds inserted" ) ) ; } } , ( err ) => { reject ( err ) ; } ) ; } ) ; }
This function must return a promise, which persists the authorization_request
object, and resolve with the ID for the persisted authorization_request.  The
ID can be used later to retrieve the persisted authorization_request.

@param   authorization_request
@return authorization_request_id
This function must return a promise which persists the authorization_request object and resolve with the ID for the persisted authorization_request . The ID can be used later to retrieve the persisted authorization_request .