수

Node.js MongoDB Drop

Node.js MongoDB Drop

컬렉션 드롭
이 drop()메소드 를 사용하여 MongoDB에서 호출 할 때 테이블 또는 콜렉션을 삭제할 수 있습니다 .

이 drop()메서드는 오류 객체 및 결과 매개 변수를 포함하는 콜백 함수를 사용하며 컬렉션이 성공적으로 삭제되면 true를 반환하고 그렇지 않으면 false를 반환합니다.

예

var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  var dbo = db.db("mydb");
  dbo.collection("customers").drop(function(err, delOK) {
    if (err) throw err;
    if (delOK) console.log("Collection deleted");
    db.close();
  });
});

|

댓글 1개

감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 19-06-24 조회 3,211
PHP 19-06-09 조회 3,829
MySQL 19-04-01 조회 4,886
jQuery 19-03-20 조회 4,272
node.js 19-02-12 조회 3,374
node.js 19-02-12 조회 3,113
node.js 19-02-12 조회 3,375
node.js 19-02-07 조회 3,346
node.js 19-02-07 조회 3,088
node.js 19-02-07 조회 3,226
node.js 19-02-04 조회 2,972
node.js 19-02-04 조회 2,945
node.js 19-02-04 조회 3,390
node.js 19-01-31 조회 2,496
node.js 19-01-31 조회 2,651
node.js 19-01-31 조회 3,123
node.js 19-01-28 조회 2,912
node.js 19-01-28 조회 2,977
node.js 19-01-28 조회 2,816
node.js 19-01-22 조회 3,166
node.js 19-01-22 조회 2,903
node.js 19-01-22 조회 3,361
node.js 19-01-16 조회 2,779
node.js
[node.js]
19-01-16 조회 2,673
node.js 19-01-16 조회 9,349
node.js 19-01-12 조회 4,424
node.js 19-01-12 조회 3,047
node.js 19-01-12 조회 3,170
node.js 19-01-11 조회 2,717
node.js 19-01-11 조회 4,073