成功启动MongoDB后,再打开一个命令行窗口输入mongo,就可以进行数据库的一些操作. 输入help可以看到基本操作命令: show dbs:显示数据库列表 show collections:显示当前数据库中的集合(类似关系数据库中的表) show users:显示用户 use :切换当前数据库,这和MS-SQL里面的意思一样 db.help():显示数据库操作命令,里面有很多的命令 db.foo.help():显示集合操作命令,同样有很多的命令,foo指的是当前数据库下,一个叫foo的集合
以下语法为在控制台使用的.假定有集合(相当于关系型数据库的库)qyxxcx,文档(相当于表)qyxx,jyzcjzs show dbs use qyxxcx db show collections db.qyxx.drop() db.qyxx.find() db.qyxx.findOne() db.qyxx.find({"Name": "abcd"}) db.qyxx.aggregate([{$lookup:{from: "yjzcjzs",lo
using System; using System.Collections.Generic; using System.Linq; using System.Text; using MongoDB; namespace ConsoleApplication34 { class Program { static void Main(string[] args) { //Create Database Mongo mongoDBdataBase = new Mongo(); mongoDBdata