是否有一个样本MongoDB数据库沿世界线MySql?

作为Mongo的新手,我正在寻找一个可导入和使用的MongoDB数据库示例。 沿着世界的线为MySQL或Northwind的MSSQL的东西。

有一个吗? (我在http://www.mongodb.org找不到任何提及,也没有我的search帮助)

对于* NIX / Mac OS,这可以通过两个简单的步骤完成

wget http://media.mongodb.org/zips.json mongoimport -v --file=zips.json 

对于Windows用户:如果您使用的是Windows 7,请按照以下步骤从json文件导入:

  • 下载上面提到的JSON文件,并把它放在一个文件夹(比如d:\sample
  • 打开命令提示符,进入bin目录并inputmongoD来启动mongo服务器
  • 现在采取另一个命令提示符并再次进入bin目录并写入以下命令

    C:\mongodb\bin>mongoimport --db test --collection zips --file d:\sample\zips.json

  • 导入应该立即开始工作,最后应该显示如下: Thu Dec 19 17:11:22导入29470个对象

而已!

我发现这可以导入json数据:

 mongoimport --db scratch --collection zips --file zips.json 

我想你可以导入你find的任何json数据,它也支持csv和tsv。 希望这可以帮助。

这并不是什么都有,但这对于在MongoDB上获得Northwind是一个很好的步骤:

https://github.com/tmcnab/northwind-mongo

在按照@tslater下载Northwind数据之后,我把它清理了一下。

并运行以下PowerShell命令导入到mongo中:

 Get-ChildItem "C:\MongoDb\samples\northwind\csv" -Filter *.csv | ` Foreach-Object { C:\MongoDb\bin\mongoimport.exe -h localhost:55000 -d northwind -c $_.BaseName --type csv --file $_.FullName --headerline } 

https://github.com/tmcnab/northwind-mongo/archive/master.zip下载Northwind csv文件的集合

执行以下命令将csv导入到mongodb中

 mongoimport -d Northwind -c categories --type csv --file categories.csv --headerline mongoimport -d Northwind -c customers --type csv --file customers.csv --headerline mongoimport -d Northwind -c employee-territories --type csv --file employee-territories.csv --headerline mongoimport -d Northwind -c employees --type csv --file employees.csv --headerline mongoimport -d Northwind -c northwind --type csv --file northwind.csv --headerline mongoimport -d Northwind -c order-details --type csv --file order-details.csv --headerline mongoimport -d Northwind -c orders --type csv --file orders.csv --headerline mongoimport -d Northwind -c products --type csv --file products.csv --headerline mongoimport -d Northwind -c regions --type csv --file regions.csv --headerline mongoimport -d Northwind -c shippers --type csv --file shippers.csv --headerline mongoimport -d Northwind -c suppliers --type csv --file suppliers.csv --headerline mongoimport -d Northwind -c territories --type csv --file territories.csv --headerline 

这可以用于Windows和Liinux操作系统

http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/在链接提供了一个json文件:; http : //media.mongodb.org/zips.json这是邮政编码数据。

这可以用于Map-Reduce,Aggregation和Grouping查询学习目的,上面的MongoDB教程链接也显示了如何。

对于Windows:您可以安装MongoVUE工具(来自http://www.mongovue.com ),该工具是用于MongoDB shell操作的IDE,还提供了Map-Reduce,Aggregation和Filtering支持以及从MySQL数据库到MongoDB的数据导入。

上面链接中的JSON文件有3个重复的_id条目,这会阻碍导入过程,您可能必须为插入的文档执行removeall操作。 但最终你的collections中应该有29,467个文件。

导入后的MongoVUE IDE

您可以创buildTPC-H基准数据集并导入它们。

lineitem表的示例导入:

 ./mongoimport -d test -c lineitem --type csv -f l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment --file /home/metdos/mongo/tpc-h/tpch_2_13_0/lineitem.tbl 

我更新电影收集,每当得到空闲时间。 就个人而言,它对我来说非常有用,因为它包含embedded对象,数组字段,string字段,date字段。 点击这里获取电影collections的 JSON文件

一个文件的演示

 { "_id" : ObjectId("5692a15524de1e0ce2dfcfa3"), "title" : "Toy Story 4", "year" : 2011, "rated" : "G", "released" : ISODate("2010-06-18T04:00:00.000Z"), "runtime" : 206, "countries" : [ "USA" ], "genres" : [ "Animation", "Adventure", "Comedy" ], "director" : "Lee Unkrich", "writers" : [ "John Lasseter", "Andrew Stanton", "Lee Unkrich", "Michael Arndt" ], "actors" : [ "Tom Hanks", "Tim Allen", "Joan Cusack", "Ned Beatty" ], "plot" : "The toys are mistakenly delivered to a day-care center instead of the attic right before Andy leaves for college, and it's up to Woody to convince the other toys that they weren't abandoned and to return home.", "poster" : "http://ia.media-imdb.comhttp://img.dovov.comM/MV5BMTgxOTY4Mjc0MF5BMl5BanBnXkFtZTcwNTA4MDQyMw@@._V1_SX300.jpg", "imdb" : { "id" : "tt0435761", "rating" : 8.4, "votes" : 500084 }, "tomato" : { "meter" : 99, "image" : "certified", "rating" : 8.9, "reviews" : 287, "fresh" : 283, "consensus" : "Deftly blending comedy, adventure, and honest emotion, Toy Story 3 is a rare second sequel that really works.", "userMeter" : 89, "userRating" : 4.3, "userReviews" : 602138 }, "metacritic" : 92, "awards" : { "wins" : 56, "nominations" : 86, "text" : "Won 2 Oscars. Another 56 wins & 86 nominations." }, "type" : "movie", "reviews" : [ { "date" : ISODate("2017-02-13T04:00:00.000Z"), "name" : "parvesh", "rating" : 8.9, "comment" : "My first review for Toy Story 3, hoping it will execute while trying for the very first time." }, { "date" : ISODate("2017-02-13T04:00:00.000Z"), "name" : "Prabhash", "rating" : 9.3, "comment" : "My second review for Toy Story 3, hoping it will execute while trying for the very first time." }, { "date" : ISODate("2017-02-11T04:00:00.000Z"), "name" : "praveen", "rating" : 6.7, "comment" : "My third review for Toy Story 3, hoping it will execute while trying for the very first time." } ] }