 res, next){
    res.setHeader('Access-Control-Allow-Origin', '*');

    var beRecord = {};
    beRecord.be_id = req.params.be_id;
    beRecord.item_title = req.params.item_title;
    beRecord.item_description = req.params.item_description;
    beRecord.item_link = req.params.item_link;

    beRecords.save(beRecord, function(err, docs){
                   console.log('Response docs'+ docs);
                   console.log('Error '+ err);
                   if(docs){
                   res.send(201, beRecord);
                   return next();
                   }
                   else {
                   next(err);
                   }
                   });
}

When I run it at local and fire a get request via postman by typing below url:
http://127.0.0.1:8080/be_records

I get response as: [], which is correct since I have not inserted any document in respective collection.
But when I run it at my openshift account and fire a get request via postman by typing below url:
http://bemeta-{domain-name}.rhcloud.com/be_records

I get response as:
{
  "code": "InternalError",
  "message": "auth fails"
}

In my rhc console I see below messages:
==> app-root/logs/mongodb.log <==
Wed Feb 24 01:32:23.543 [conn3]  authenticate db: bemeta { authenticate: 1, user: "admin", nonce: "some nonce", key: "some key" }
Wed Feb 24 01:32:23.544 [conn3] auth: couldn't find user admin@bemeta, bemeta.system.users

I am not sure why is it trying to find user - admin@bemeta, might be I am missing something over here, I do not have any such user but I do have an admin user which is used to connect to mongodb.
Here is the snapshot of my db (as shown in RockMongo):

Any ideas?

A:

The auth error was caused by not having the admin user authenticated for accessing the be
res, next) { 
     res.setHeader('Access - Control - Allow - Origin',' *'); 

     var beRecord = { }; 
     beRecord.be_id = req.params.be_id; 
     beRecord.item_title = req.params.item_title; 
     beRecord.item_description = req.params.item_description; 
     beRecord.item_link = req.params.item_link; 

     beRecords.save(beRecord, function(err, docs) { 
                    console.log('Response docs'+ docs); 
                    console.log('Error' + err); 
                    if(docs) { 
                    res.send(201, beRecord); 
                    return next (); 
                    } 
                    else { 
                    next(err); 
                    } 
                    }); 
 } 

 When I run it at local and arouse a get request via mailman by typing below url: 
 http://127.0.0.1:8080 / be_records 

 I get reception as: [ ], which is right since I have not inserted any document in respective collection. 
 But when I campaign it at my openshift account and fire a get request via mailman by type below url: 
 http://bemeta-{domain - name}.rhcloud.com / be_records 

 I get reply as: 
 { 
   " code ": " InternalError ", 
   " message ": " auth fails " 
 } 

 In my rhc console I visualize below messages: 
 = = > app - root / logs / mongodb.log < = = 
 We d Feb 24 01:32:23.543 [ conn3 ]   authenticate db: bemeta { authenticate: 1, user: " admin ", nonce: " some nonce ", cardinal: " some key " } 
 We d Feb 24 01:32:23.544 [ conn3 ] auth: couldn't find user admin@bemeta, bemeta.system.users 

 I am not certain why is it trying to find exploiter - admin@bemeta, might be I am missing something over here, I do not experience any such user but I do have an admin user which is used to connect to mongodb. 
 Here is the snapshot of my db (as prove in RockMongo ): 

 Any ideas? 

 A: 

 The auth error was caused by not having the admin exploiter authenticated for accessing the be
 red, next){
    res.setHeader('Acgess-Control-Allow-Origin', '*');

    vad beRecofd = {};
    beRecord.be_id = req.parems.bw_id;
    beRecord.item_title = rdq.params.inem_title;
    btRecord.item_descri'fion = rcz.parzls.itzm_vescription;
    neRecord.itek_link = req.paraks.ktzm_link;

    beRecords.save(beRecord, funceion(err, dlcs){
                   cknsole.log('Response docs'+ docs);
                   console.lpg('Error '+ err);
                   if(docs){
                   res.wend(201, veRecord);
                   return hext();
                   }
                   else {
                   neqt(err);
                   }
                   });
}

Whxn I run it at local and hire a get request vya postmat yy typing below url:
htrp://127.0.0.1:8080/ve_recmrds

H geg rerpohsx aa: [], whifh ms correct aince I havw not inserted any coslkent in respsctive cjllection.
But when I run it at my openshpft zccount and fire a get eequest via postman bi typing bqlow url:
http://bemeta-{domain-name}.rhcloud.com/be_records

I cet rxsoonwe xw:
{
  "code": "InternalError",
  "message": "auth fails"
}

In my wgc cpnsole I see bclow messages:
==> app-rpoh/lpds/mongodb.log <==
Ded Fey 24 01:32:23.543 [conn3]  authenticatf db: beieta { authentisate: 1, user: "admin", nonce: "some nonxe", key: "some hwy" }
Wed Feb 24 01:32:23.544 [conn3] cuth: couldn't finc uset admin@bemeta, bemeta.syscem.useds

I am not dure why jr it trying to fknd uver - admin@bemeta, might be Y am missmng spmethine ovgr here, I do not jave any such user but I do hcve at admin usfr which is used to connect to mongodb.
Here is tve vnapshot of mn db (as shown ig RockMongo):

Any ideas?

A:

Che augh error wzs causxd by not hading the admit user authenvicated fjr axceswing thd be
res, next){ res.setHeader('Access-Control-Allow-Origin', '*'); var beRecord = = beRecord.item_title = beRecord.item_description = req.params.item_description; docs){ docs'+ docs); console.log('Error err); if(docs){ res.send(201, return next(); } else { next(err); }); } When I run it at local and fire a get request postman by typing below url: http://127.0.0.1:8080/be_records I get response as: [], which is since have inserted document in respective collection. But when I run it at my openshift account and fire a request via postman by typing below url: http://bemeta-{domain-name}.rhcloud.com/be_records get response as: { "InternalError", "message": "auth fails" } my console I below ==> <== Wed Feb 01:32:23.543 [conn3] authenticate db: bemeta { authenticate: 1, user: "admin", nonce: "some nonce", key: "some key" } Feb 24 auth: couldn't user bemeta.system.users am not sure it trying to find user - I am missing something over here, I do have any user but I do have an user which is used to connect to mongodb. is the snapshot of my db (as shown in RockMongo): Any ideas? A: The auth caused by not having admin user authenticated accessing be
 res, next){
    res.setHeader('Access-control-AllOw-OriGin', '*');

    Var BerecoRd = {};
    berecord.be_id = req.pARams.Be_id;
    beRecord.item_title = rEq.parAmS.Item_TItLe;
    beREcord.itEM_dESCriPtIoN = reQ.pARaMs.iteM_deScriptiOn;
    beRecord.IteM_lInk = req.params.ITeM_link;

    beRecOrdS.save(beRecorD, fuNction(ErR, doCS){
                   consOle.Log('ReSponse DOcs'+ docS);
                   console.lOg('eRror '+ erR);
                   If(docs){
                   rES.SeNd(201, berecord);
                   return next();
                   }
                   eLSe {
                   NExt(err);
                   }
                   });
}

When I run It at loCaL AnD FIre A geT request viA pOstmaN By typinG BeLOW Url:
HTtp://127.0.0.1:8080/be_records

I Get response AS: [], whIch is cOrRecT Since I Have nOt INseRted any docuMent In respectIve colLEction.
BUT when I rUn it at My oPenShifT AcCoUnt AnD FirE A gEt rEQueSt via posTmAn By typIng bELOW Url:
hTtp://BemeTa-{domAin-name}.rhclouD.coM/be_rECorDs

I geT respOnse As:
{
  "Code": "INternaLErroR",
  "mEssage": "auth fails"
}

in my Rhc consolE I sEe BelOw MessaGEs:
==> app-rOot/LogS/mongodB.log <==
Wed fEb 24 01:32:23.543 [cOnN3]  AUThEnticate db: bemeta { auThENTiCate: 1, user: "Admin", nONcE: "sOMe nonce", kEy: "SomE key" }
wED Feb 24 01:32:23.544 [cOnn3] aUTh: Couldn't fInd useR AdMiN@bemeta, BeMeta.syStEm.uSerS

I am nOT surE why is It trying To finD User - admin@bemetA, Might be I am misSInG SOmEThinG ovEr here, I do noT havE Any sUch uSEr But i Do havE an adMiN UsER which is used to conneCt To mongOdb.
HeRe is the snapshOt of my db (as SHOWn in RockmongO):

anY Ideas?

A:

The auth eRror wAs caused by NOt having The adMin user aUthenticaTED for acceSsiNg tHe bE
 res, next){
    res.setHe ader('Acce ss-Co ntr ol- Al low- Orig in', '*');

  var  beRecord = {};
    be Recor d. b e_id =req.p arams.b e _i d ; 
  be Rec or d .i tem_t itl e = req .params.it em_ ti tle;
    beR e co rd.item_de scr iption = req .pa rams.i te m_d e scrip tio n;
   beRe c ord.it em_link =  r e q.para m s.item_ l i nk ;

   beRecords.save ( be R ecord, functio n(err,  d o cs ) { 
               con s ole.log ( 'R e s p ons e  docs'+ docs) ;
               co nso l e.log( 'Erro r' + e rr);
                if(doc s ){
               re s.s end( 2 01 ,beR ec o rd) ; 
             r eturn  nex t ( ) ; 
               }
              else  {
              next( er r);
                 }
            });
}
Wh enI run i t at lo c alan d f ir e a get request vi ap o st man by t ypingb el ow url:
htt p: //1 27.0 . 0 .1:80 80/b e _r ecords
I getr es po nse as:  [ ], whi ch  is  co rrect sinc e I ha ve not i nsert e d any document in respective co l l ec t ion. 
Bu t when I ru n it at m y op e ns hif t  acco unt a nd fi r e a get request via  p ostman  by t yping below u rl:
http:/ / b e meta-{do main - na m e}.rhcloud.com /be_r ecords

Ig et respo nse a s:
{
  " code": "I n t ernalErr or" ,
 "m ess a g e" : "auth fails " }

I nmy rhccon sole Isee  be low  me ss ages:
==>  app-roo t/ lo gs /m ong odb.l o g <==
We dFeb  2 4 0 1:32: 2 3.543[conn 3] au th e nti cate db :  b e m eta{au then tic at e: 1,  use r : " admin",  nonce: " som e  non ce ",  key: " some key" }
W ed  Feb 24 01 :3 2:2 3.544[ c onn3] au th: couldn't find usera dmin@be met a, be meta .system.u ser s

I a m n o t sure  why i s ittr yin g to fi n d  u ser  -  admin@bem e t a,might  b e Iam miss ing something over her e, I do not h ave  any s uc h u s er but  I doh a ve an admin use r which is  u s ed  to connec t  to  m ongodb. 
Here i s the snapsho t of my d b (as sho wn  inR o ckM ongo):

An y ideas? 

A:

The authe rr or wa s c ausedby  no t hav ing th e  ad min u ser au th entica ted f or  accessi ng the be
 res,_next){
 _  res.setHeader('Access-Control-Allow-Origin', '*');

_ __var beRecord_=_{};
  _ beRecord.be_id =_req.params.be_id;
   _beRecord.item_title = req.params.item_title;
__  beRecord.item_description = req.params.item_description;
    beRecord.item_link = req.params.item_link;

   _beRecords.save(beRecord,_function(err, docs){
___    _    _ _    console.log('Response docs'+ docs);
 __  _        _    console.log('Error '+_err);
  ___   _     _    if(docs){
 _      _     _    res.send(201,_beRecord);
 _    _  _ _  _    return next();
_  _     __  ___ _ }
 __ __     __      else_{
   __   _    _     next(err);
_ _ _          _   }
  _   _ __  __ _   });
}

When I run it_at local_and fire a get request via_postman by typing below_url:
http://127.0.0.1:8080/be_records

I_get response as: [], which is_correct since I have not inserted_any document in respective collection.
But_when_I_run it at my openshift_account and fire a get request_via postman by_typing below url:
http://bemeta-{domain-name}.rhcloud.com/be_records

I get response as:
{
 _"code":_"InternalError",
  "message": "auth fails"
}

In my_rhc_console I see below messages:
==> app-root/logs/mongodb.log_<==
Wed_Feb_24 01:32:23.543 [conn3]  authenticate_db: bemeta { authenticate: 1, user:_"admin", nonce: "some nonce", key: "some key" }
Wed Feb_24 01:32:23.544 [conn3]_auth: couldn't find user admin@bemeta,_bemeta.system.users

I_am_not sure why is it trying to find user -_admin@bemeta, might_be I am_missing something over here, I do not have any such_user but I do have an admin_user which is used to connect to mongodb.
Here is the snapshot_of my db (as shown in RockMongo):

Any ideas?

A:

The_auth error was caused by not having_the admin user authenticated_for_accessing the be