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的更多相关文章

  1. Pytorch Dataset和Dataloader 学习笔记(二)

    Pytorch Dataset & Dataloader Pytorch框架下的工具包中,提供了数据处理的两个重要接口,Dataset 和 Dataloader,能够方便的使用和加载自己的数据 ...

  2. ABAP DEMO

    sap Program DEMO 介绍 Program Description BALVBT01 Example SAP program for displying multiple ALV repo ...

  3. 使用Apriori算法和FP-growth算法进行关联分析

    系列文章:<机器学习实战>学习笔记 最近看了<机器学习实战>中的第11章(使用Apriori算法进行关联分析)和第12章(使用FP-growth算法来高效发现频繁项集).正如章 ...

  4. Machine Learning for Developers

    Machine Learning for Developers Most developers these days have heard of machine learning, but when ...

  5. 数据关联分析 association analysis (Aprior算法,python代码)

    1基本概念 购物篮事务(market basket transaction),如下表,表中每一行对应一个事务,包含唯一标识TID,和购买的商品集合.本文介绍一种成为关联分析(association a ...

  6. Python如何进行cross validation training

    以4-fold validation training为例 (1) 给定数据集data和标签集label 样本个数为 sampNum = len(data) (2) 将给定的所有examples分为1 ...

  7. JSON解析之Gson

    1.Gson简介 Gson是一个将Java对象转为JSON表示的开源类库,由Google提供,并且也可以讲JSON字符串转为对应的Java对象.虽然有一些其他的开源项目也支持将Java对象转为JSON ...

  8. 《Spark Python API 官方文档中文版》 之 pyspark.sql (二)

    摘要:在Spark开发中,由于需要用Python实现,发现API与Scala的略有不同,而Python API的中文资料相对很少.每次去查英文版API的说明相对比较慢,还是中文版比较容易get到所需, ...

  9. Emsemble

    RM # -*- coding: utf-8 -*- """ RandomForestClassifier 예 """ import pan ...

随机推荐

  1. 海尔公布首套智能套装SmartCare,主打智能、简单

        2014CIE智能硬件首发会于11月6-8日在上海国际展览中心举行.吸引了海尔.英特尔.百度等知名企业的积极參与. 作为国内智能家居领域的先驱者,海尔在本次大会上首发了轻量智能套装SmartC ...

  2. OPENWRT中SSH免密钥登陆(具体步骤)

    通过使用ssh-keygen生成公钥,在两台机器之间互相建立新人通道极客. 如果本地机器是client,远程机器为server. 1.使用ssh-keygen生成rsa keygen(在这里会覆盖曾经 ...

  3. Systemd启动图形界面过程

    1 启动命令 systemctl isolate graphical.target 2 启动过程: 文件:/etc/systemd/system/graphical.target 来自:systemd ...

  4. 改动android 系统时间

    命令如 date -s "yyyymmdd.[[[hh]mm]ss]" 直接在CRT上执行,举例:date -s "20120801.120503" 但在adb ...

  5. ActionBarActivity设置全屏无标题

    新建的Activity继承自ActionBarActivity,设置全屏无标题本来非常easy的事,可是没想到app居然无缘无故的挂,要么就是白屏一片,要么就是黑屏.坑了我一个多小时.!! 原因是Ac ...

  6. m_Orchestrate learning system---十五、如何快速查错

    m_Orchestrate learning system---十五.如何快速查错 一.总结 一句话总结: a.删除代码法 b.添加提示代码法 c.仔细看错误信息 1.评论板块和论坛板块的实时更新? ...

  7. kibana智能检索发送多次_msearch —— 配置index pattern,同时设置时间段,就知道到底是在哪些索引里去查找数据了

    kibanasite/elasticsearch/log-*/_field_stats?level=indices      返回: {"_shards":{"total ...

  8. oracle-常见的执行计划(一)

    一.表访问方式 CBO基础概念中有讲到,访问表的方式有两种:全表扫描和ROWID扫描. 全表扫描的执行计划:TABLE ACCESS FULL ROWID扫描对应执行计划:TABLE ACCESS B ...

  9. oc语言的特点

    oc语言的特点分为以下几个方面: 1.运行时: 2.block闭包: 3.内存管理: 4.大中枢派发: 一.运行时的基础是isa 类结构:由clang编译前端支撑. 从它衍生出以下几个特征: 1.消息 ...

  10. BZOJ2161: 布娃娃 整体二分

    Code: #include <cstdio> #include <algorithm> #include <cstring> #include <vecto ...