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 ...
随机推荐
- Fedora 17 无线网卡配置笔记
转载:http://www.psichen.com/fedora-17-wifi/ 安装并更新完F17后,在网络选项中没有出现无线网,需要自己安装无线网卡驱动.而F17中默认网卡名称从以前的”eth0 ...
- cocos2dx-3.0创建Android项目时遇到的错误。
cocos run -p android出现 文件名称.文件夹名或卷标语法不对 Updated project.properties Updated local.properties Updated ...
- Hibernate的xml方法配置和操作代码
一.gradle中包: compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.12.Final' compile ...
- dpdk l2fwd 应用流程分析
int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; struct rte_eth_dev_info dev_info; ...
- Extjs4.2 ajax请求url中传中文參数乱码问题
今天有个需求须要在url中传入中文參数.结果在后台取得时出现乱码,怀疑可能是编码问题.上网查询了资料,试了几种办法.发现有一种可行,记录在此,以便查阅. url中用encodeURI 进行2次编码: ...
- 操作系统 之 哈希表 Linux 内核 应用浅析
1.基本概念 散列表(Hash table.也叫哈希表).是依据关键码值(Key value)而直接进行訪问的数据结构. 也就是说,它通过把关键码值映射到表中一个位置来訪问记录.以 ...
- DB-MySQL:MySQL 语句性能优化
ylbtech-DB-MySQL:MySQL 语句性能优化 1.返回顶部 1. MySQL概述1.数据库设计 3范式2.数据库分表分库---会员系统() 水平分割(分页如何查询)MyChar .垂直3 ...
- 91.Bower : ENOGIT git is not installed or not in the PATH 解决方法
转自:https://www.haorooms.com/post/bower_error 今天在用bower安装依赖的时候,出现了Bower : ENOGIT git is not installed ...
- Go语言结构体转json的坑
Go语言结构体转json的坑 标签(空格分隔): go json.Marshal() JSON输出的时候必须注意,只有导出的字段(首字母是大写)才会被输出,如果修改字段名,那么就会发现什么都不会输出, ...
- oracle 11g dbms_workload_repository手工管理AWR快照,基线
1.修改快照设置[sql] view plain copysys@ORCL> select * from dba_hist_wr_control; DBID SNAP_INTERVAL RETE ...