第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用 mongodb 和 PHP 從“system.users”中刪除用戶?

如何使用 mongodb 和 PHP 從“system.users”中刪除用戶?

PHP
猛跑小豬 2022-07-09 16:28:42
我需要一點(diǎn)幫助。我無(wú)法從 MongoDB 數(shù)據(jù)庫(kù)中刪除“System.User”用戶。/*Remove Tenent DB*/function RemoveTenentDB($mydb){   error_reporting(0);   $connection_string = Config::get('database.creator-tenant-uri');   $m = new MongoClient($connection_string); //create interface to mongo   $command = array   (       "dropUser" => $mydb   );   $db = $m->selectDB( $mydb );   $db->command( $command );   #drop databse   $db = $m->dropDB( $mydb );   return true;}下面的代碼只刪除數(shù)據(jù)庫(kù)和特定的數(shù)據(jù)庫(kù)用戶,而不是“System.User”$command = array   (       "dropUser" => $mydb   );   $db = $m->selectDB( $mydb );   $db->command( $command );   $db = $m->dropDB( $mydb );
查看完整描述

2 回答

?
繁華開滿天機(jī)

TA貢獻(xiàn)1816條經(jīng)驗(yàn) 獲得超4個(gè)贊

以下 db.dropUser() 操作將 reportUser1 用戶刪除到產(chǎn)品數(shù)據(jù)庫(kù)中。

use products
db.dropUser("reportUser1", {w: "majority", wtimeout: 5000})

參考:db.dropUser

嘗試以下代碼的php

$users = $conn->$db_name->selectCollection('system.users')->delete();


查看完整回答
反對(duì) 回復(fù) 2022-07-09
?
侃侃爾雅

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊

如果我理解正確,您正在尋找使用 PHP 刪除 mongodb 數(shù)據(jù)庫(kù)中的一個(gè)集合。如果是這種情況,您可以使用以下方法從 mongodb 中刪除一個(gè)集合。

$collection = $mongo->my_db->System.User;
$response = $collection->drop();

您可以按照以下鏈接獲取有關(guān)相同內(nèi)容的更多詳細(xì)信息 - https://www.php.net/manual/en/mongocollection.drop.php



查看完整回答
反對(duì) 回復(fù) 2022-07-09
  • 2 回答
  • 0 關(guān)注
  • 120 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)