mongodb入门命令-创建表数据

mongodb入门命令-创建表数据


2024年4月13日发(作者:wifi网络管理)

> ()

{ "_id" : 1, "name" : "oppoR11", "price" : "3000" }

1.9 删除表 ();

> show collections

goods

user

> ();

true

> show collections;

user

>

2.0 删除数据库

tabase()

> show dbs;

admin 0.000GB

config 0.000GB

local 0.000GB

shop 0.000GB

> use shop;

switched to db shop

> tabase();

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

> show dbs;

admin 0.000GB

config 0.000GB

local 0.000GB

>

2.1 查询帮助 ();

> ()

DB methods:

ommand(nameOrDocument) - switches to 'admin' db, and runs command [just calls mand(...)]

ate([pipeline], {options}) - performs a collectionless aggregation on this database; returns a cursor

(username, password)

atabase(fromhost) - deprecated

dHelp(name) returns the help for the command

tabase(fromdb, todb, fromhost) - deprecated

Collection(name, {size: ..., capped: ..., max: ...})

View(name, viewOn, [{$operator: {...}}, ...], {viewOptions})

User(userDocument)

tOp() displays currently executing operations in the db

tabase()

() - deprecated

ock() flush data to disk and lock server for backups

nlock() unlocks server following a ock()

lection(cname) same as db['cname'] or

lectionInfos([filter]) - returns a list that contains the names and options of the db's collections

lectionNames()

tError() - just returns the err msg string

tErrorObj() - return full status object

Components()

go() get the server connection object

go().setSlaveOk() allow queries on a replication slave server

e()

vError()

filingLevel() - deprecated

filingStatus() - returns if profiling is on and slow threshold

licationInfo()

lingDB(name) get the db at the same server as this one

teConcern() - returns the write concern used for any operations on this db, inherited from server object if set

fo() get details about the server's host

er() check replica primary status

(opid) kills the current operation in the db

mmands() lists all the db commands

rverScripts() loads all the scripts in

()

ollectionStats()

eplicationInfo()

hardingStatus()

laveReplicationInfo()

er(username)

Database()

rror()

mand(cmdObj) run a database command. if cmdObj is a string, turns it into {cmdObj: 1}

Status()

Level(level,)

filingLevel(level,slowms) 0=off 1=slow 2=all

teConcern() - sets the write concern for writes to the db

riteConcern() - unsets the write concern for writes to the db

boseShell(flag) display extra information in shell output

wnServer()

()

n() current version of the server


发布者:admin,转转请注明出处:http://www.yc00.com/num/1713015951a2167172.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信