Help language development. Donate to The Perl Foundation

MongoDB cpan:MARTIMM last updated on 2020-07-19

doc/Other/User config info.txt
--------------------------------------------------------------------------------
'site-admin', '[email protected]', role => 'userAdminAnyDatabase', db => 'admin'
'Dondersteen', '[email protected]', role => 'readWrite', db => 'test'


$doc = $users.create-user(
  'site-admin', '[email protected]',
  :custom-data((user-type => 'site-admin'),),
  :roles([(role => 'userAdminAnyDatabase', db => 'admin'),])
);


--------------------------------------------------------------------------------
my MongoDB::Collection $u = $db-admin.collection('system.users');
my MongoDB::Cursor $uc = $u.find( :criteria( user => 'site-admin',));
$doc = $uc.fetch;


BSON::Document.new((
  _id => "test.site-admin",
  user => "site-admin",
  db => "test",
  credentials => BSON::Document.new((
    SCRAM-SHA-1 => BSON::Document.new((
      iterationCount => 10000,
      salt => "Mpisumty8wQK7oi9KtDfeA==",
      storedKey => "bG4ozEGjYMXqcF/NfHGEbdPoRZc=",
      serverKey => "hyrU91E3C+ufBlogxNYn37MpDJY=",
    )),
  )),
  customData => BSON::Document.new((
    user-type => "site-admin",
  )),
  roles => [
        BSON::Document.new((
      role => "userAdminAnyDatabase",
      db => "admin",
    )),
  ],
))