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

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