search

Home  >  Q&A  >  body text

mongoDB创建新的空数据库有没有存储起来?

use newdb创建新的数据库不插入任何数据的情况下用show dbs是不会显示这个数据库的,这样的话应该没加到内存。但是删除它却显示{ "ok" : 1 }没报错,所以我想问一下创建新的空数据库有没有存储起来?

ringa_leeringa_lee2870 days ago560

reply all(1)I'll reply

  • 黄舟

    黄舟2017-04-28 09:06:09

    1. No storage
    2. You can execute this command test again after passing db.dropDatabase(), and it will also return { ok: 1 }

    use memberSystem

    switched to db memberSystem

    db.dropDatabase()

    { "dropped" : "memberSystem", "ok" : 1 }

    db.dropDatabase()

    { "dropped" : "memberSystem", "ok" : 1 }

    db.dropDatabase()

    3. Mongodb will not determine whether the database exists when deleting, but directly performs the deletion process. As long as no error is reported, {ok:1} will be returned, even if there is no such database

    reply
    0
  • Cancelreply