Import Example Dataset
Overview
The examples in this guide use the restaurants collection in the test database.
The following is a sample document in the restaurants collection:
{
"address": {
"building": "1007",
"coord": [ -73.856077, 40.848447 ],
"street": "Morris Park Ave",
"zipcode": "10462"
},
"borough": "Bronx",
"cuisine": "Bakery",
"grades": [
{ "date": { "$date": 1393804800000 }, "grade": "A", "score": 2 },
{ "date": { "$date": 1378857600000 }, "grade": "A", "score": 6 },
{ "date": { "$date": 1358985600000 }, "grade": "A", "score": 10 },
{ "date": { "$date": 1322006400000 }, "grade": "A", "score": 9 },
{ "date": { "$date": 1299715200000 }, "grade": "B", "score": 14 }
],
"name": "Morris Park Bake Shop",
"restaurant_id": "30075445"
}
Use the following procedure to populate the restaurants collection. populate vt. 居住于;构成人口;移民于;殖民于
Prerequisites
You must have a running mongod instance in order to import data into the database.
Procedure
Retrieve the restaurants data.
Retrieve the dataset from https://raw.githubusercontent.com/mongodb/docs-assets/primer-dataset/primer-dataset.json and save to a file named primer-dataset.json.
复制链接,直接放到迅雷里面下载
Import data into the collection.
In the system shell or command prompt, use mongoimport to insert the documents into the restaurants collection in the test database.
If the collection already exists in the test database, the operation will drop the restaurants collection first.
mongoimport --db test --collection restaurants --drop --file ~/downloads/primer-dataset.json
The mongoimport connects to a mongod instance running on localhost on port number 27017.
The--file option provides the path to the data to import, in this case, ~/downloads/primer-dataset.json.
To import data into a mongod instance running on a different host or port, specify the hostname or port by including the --host and the --port options in your mongoimport command.
F:\DataBase\MongoDB\test>mongoimport --db test --collection restaurants --drop -
-file ../primer-dataset.json
2017-02-28T18:43:05.680+0800 connected to: localhost
2017-02-28T18:43:05.694+0800 dropping: test.restaurants
2017-02-28T18:43:07.160+0800 imported 25359 documents
Import Example Dataset的更多相关文章
- Pytorch Dataset和Dataloader 学习笔记(二)
Pytorch Dataset & Dataloader Pytorch框架下的工具包中,提供了数据处理的两个重要接口,Dataset 和 Dataloader,能够方便的使用和加载自己的数据 ...
- ABAP DEMO
sap Program DEMO 介绍 Program Description BALVBT01 Example SAP program for displying multiple ALV repo ...
- 使用Apriori算法和FP-growth算法进行关联分析
系列文章:<机器学习实战>学习笔记 最近看了<机器学习实战>中的第11章(使用Apriori算法进行关联分析)和第12章(使用FP-growth算法来高效发现频繁项集).正如章 ...
- Machine Learning for Developers
Machine Learning for Developers Most developers these days have heard of machine learning, but when ...
- 数据关联分析 association analysis (Aprior算法,python代码)
1基本概念 购物篮事务(market basket transaction),如下表,表中每一行对应一个事务,包含唯一标识TID,和购买的商品集合.本文介绍一种成为关联分析(association a ...
- Python如何进行cross validation training
以4-fold validation training为例 (1) 给定数据集data和标签集label 样本个数为 sampNum = len(data) (2) 将给定的所有examples分为1 ...
- JSON解析之Gson
1.Gson简介 Gson是一个将Java对象转为JSON表示的开源类库,由Google提供,并且也可以讲JSON字符串转为对应的Java对象.虽然有一些其他的开源项目也支持将Java对象转为JSON ...
- 《Spark Python API 官方文档中文版》 之 pyspark.sql (二)
摘要:在Spark开发中,由于需要用Python实现,发现API与Scala的略有不同,而Python API的中文资料相对很少.每次去查英文版API的说明相对比较慢,还是中文版比较容易get到所需, ...
- Emsemble
RM # -*- coding: utf-8 -*- """ RandomForestClassifier 예 """ import pan ...
随机推荐
- ASP.NET-关于Global.asax的作用
这个文件相当于一个应用程序量级的 全局文件,比如你想写一个变量在项目中的所有文件中都能读取是就写在这里面 Application["name"] = "zhangran& ...
- HDU 3723
把向上看成+1,向下看成-1.可以知道符合卡特兰数的一般解释了.记作Can(i) 中间平过的即是0.亦即是C(n,2*i),i表示向上的数. 于是总的就是sum(C(n,2*i)*Can(i)),i从 ...
- 【转载】黑客内核:编写属于你的第一个Linux内核模块
黑客内核:编写属于你的第一个Linux内核模块
- poj 3259 bellman最短路推断有无负权回路
Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 36717 Accepted: 13438 Descr ...
- [jzoj 4879] [NOIP2016提高A组集训第11场11.9] 少女觉 解题报告 (贪心)
题目链接: http://172.16.0.132/senior/#main/show/4879 题目: 在幽暗的地灵殿中,居住着一位少女,名为古明地觉.据说,从来没有人敢踏入过那座地灵殿,因为人们恐 ...
- BZOJ 2005 容斥原理
思路: 题目让求的是 Σgcd(i,j) (i<=n,j<=m) n,m不同 没法线性筛 怎么办? 容斥原理!! f[x]表示gcd(i,j)=x的个数 g[x]为 存在公约数=x 的数对 ...
- python 3.x 学习笔记9 (面向对象)
1.面向对象 面向对象是一种对现实世界理解和抽象的方法,是计算机编程技术发展到一定阶段后的产物. 2.类(class): 一个类即是对一类拥有相同属性的对象的抽象.蓝图.原型.在类中定义了这些对象的都 ...
- 再次建立wordpress
山大的火星人的站还在维护www.h4ck.org.cn. 也许是募课潮过后的效应,www时代还能聚合很多知识,到了客户端时代技术越发松散,很难发实用的技术总结. 如果重新审视问题不难发现,问题在于使用 ...
- 学习es6 setter/getter研究
1.背景 在ES6中,我们对类的定义如下 class Person { // 构造函数 constructor (name) { // 属性初始化 this.name = name; } // 成员方 ...
- (转载) TextView使用一些小技巧
TextView使用一些小技巧 标签: textviewandroid开发 2015-10-09 16:13 810人阅读 评论(0) 收藏 举报 分类: Android(20) 本文主要讲一些T ...