Skip to content

Commit ba4e5c7

Browse files
committed
primer: add back prereq steps
1 parent 2bd2334 commit ba4e5c7

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ primer/source/tutorial/*.rst
5555
primer/source/includes/toc-*yaml
5656
primer/source/includes/steps-*yaml
5757
!primer/source/includes/steps-client-*.yaml
58+
!primer/source/includes/steps-getting-started-prereq.yaml
5859
primer/source/includes/release-*yaml
5960
primer/source/tutorial/install-mongodb-on-*.txt
6061
!primer/config/intersphinx.yaml
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
title: Download the ``restaurants`` data.
2+
ref: "primer-data-download"
3+
edition:
4+
- shell
5+
- python
6+
- node
7+
content: "Download data <link>."
8+
---
9+
title: Import data into the collection.
10+
ref: "primer-data-import"
11+
pre: |
12+
In the system shell or command prompt, use ``mongoimport`` to insert
13+
the documents into the ``restaurants`` collection in the ``test``
14+
database. The operation will **drop** the ``restaurants`` collection
15+
first, if it already exists.
16+
action:
17+
language: javascript
18+
code: |
19+
mongoimport --db test --collection restaurants --drop --file "dataset.2015-01-20/dataset.json"
20+
edition:
21+
- shell
22+
- python
23+
---
24+
title: Switch to ``test`` database.
25+
ref: "primer-prereq-switch-db-shell"
26+
edition: shell
27+
pre: |
28+
In the ``mongo`` shell connected to a running :program:`mongod`
29+
instance, switch to the ``test`` database.
30+
action:
31+
language: javascript
32+
code: |
33+
use test
34+
---
35+
title: Switch to ``test`` database.
36+
ref: "primer-prereq-switch-db-python"
37+
edition: python
38+
pre: |
39+
From a Python Shell or IDLE, use
40+
:py:class:`~pymongo.mongo_client.MongoClient()` to connect to the
41+
running :program:`mongod` instance, and switch to the ``test``
42+
database.
43+
action:
44+
language: python
45+
code: |
46+
from pymongo import MongoClient
47+
client = MongoClient()
48+
db = client.test
49+
---
50+
title: Define required variables.
51+
ref: "primer-prereq-switch-db-node"
52+
edition: node
53+
pre: |
54+
From a ``node`` shell, define the following variables to
55+
access the required modules as well as to initialize ``url`` to the
56+
:manual:`MongoDB uri </reference/connection-string>`.
57+
action:
58+
language: javascript
59+
code: |
60+
var MongoClient = require('mongodb').MongoClient
61+
var assert = require('assert')
62+
var util = require('util').format;
63+
var url = 'mongodb://localhost:27017/test';
64+
...

0 commit comments

Comments
 (0)