From: http://hi.baidu.com/kekeles/blog/item/27bfa8ec9b53b8302697918c.html
//首先创建一个自动增长id集合 ids
>db.ids.save({name:"user", id:0});
//可以查看一下是否成功
> db.ids.find();{ "_id" : ObjectId("4c637dbd900f00000000686c"), "name" : "user", "id" : 0 }
//然后每次添加新用户之前自增一下 ids集合 获得id
>userid = db.ids.findAndMod...
删除数据库:
> use testswitched to db test> db.foo.save({name:'asdfdsf'})> show dbsadminlocaltest> dbtest> db.dropDatabase(){ "dropped" : "test", "ok" : 1 }> show dbsadminlocal>
删除集合:
> use testswitched to db test> db.foo.save({name:'sdfdsf'})> show collectionsfoosystem.indexes> db.foo.drop()...