Skip to content

Commit 19d3e5c

Browse files
authored
Beginning (mongodb#1)
* initial port * clean usage examples * remove Java * remove errant files * add api link to index page * remove refs that don't exist * add pr template
1 parent 315001f commit 19d3e5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1236
-2
lines changed

.github/pull_request_template.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Pull Request Info
2+
3+
### Issue JIRA link:
4+
https://jira.mongodb.org/browse/DOCSP-NNNNN
5+
6+
### Docs staging link (requires sign-in on MongoDB Corp SSO):
7+
https://docs-mongodborg-staging.corp.mongodb.com/golang/docsworker-xlarge/NNNNNNNNNNN/
8+
9+
### Self-Review Checklist
10+
11+
- [ ] Is this free of any warnings or errors in the RST?
12+
- [ ] Did you run a spell-check?
13+
- [ ] Did you run a grammar-check?
14+
- [ ] Does it render on staging correctly?
15+
- [ ] Are all the links working?
16+
- [ ] Are the staging links in the PR description updated?

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Editor
18+
.vscode
19+
.idea
20+
21+
# System
22+
23+
.DS_Store

README.md

-2
This file was deleted.

README.rst

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
=================================
2+
MongoDB Go Driver Documentation
3+
=================================
4+
5+
This repository contains documentation for the MongoDB Go Driver.
6+
7+
Build and Stage
8+
---------------
9+
10+
To build and stage the documentation, use the
11+
`snooty autobuilder <https://docs.google.com/document/d/1tAr5kZL0xWhAbfmn9AVsIXbF9quaFFK9nfbUhpKJEBU/edit#heading=h.lwy5m08dmc0i>`_.
12+
To get the snooty autobuilder running on your fork, add a webhook
13+
according to the autobuilder setup guide. Feel free to reach out
14+
on the *snooty-onboarding* Slack channel if you cannot access
15+
the `how-to guide <https://docs.google.com/document/d/1x6NZExTldbAZCOMdKUVdPeI-ukMM1S6qZhbKjXAZ3uQ/edit>`_.
16+
17+
Contribute
18+
----------
19+
20+
To contribute to the documentation,
21+
22+
- If you have not done so already, please sign the `MongoDB Contributor
23+
Agreement <https://www.mongodb.com/legal/contributor-agreement>`_.
24+
25+
- Fork this repository on GitHub and issue a pull request.
26+
27+
See the following documents that provide an overview of the
28+
documentation style and process:
29+
30+
- `Style Guide <http://docs.mongodb.org/manual/meta/style-guide>`_
31+
- `Documentation Practices <http://docs.mongodb.org/manual/meta/practices>`_
32+
- `Documentation Organization <http://docs.mongodb.org/manual/meta/organization>`_
33+
- `Build Instructions <http://docs.mongodb.org/manual/meta/build>`_
34+
35+
File JIRA Tickets
36+
-----------------
37+
38+
File issue reports or requests at the `Documentation Jira Project
39+
<https://jira.mongodb.org/browse/DOCS>`_.
40+
41+
Licenses
42+
--------
43+
44+
All documentation is available under the terms of a `Creative Commons
45+
License <http://creativecommons.org/licenses/by-nc-sa/3.0/>`_.
46+
47+
The MongoDB Documentation Project is governed by the terms of the
48+
`MongoDB Contributor Agreement
49+
<https://www.mongodb.com/legal/contributor-agreement>`_.
50+
51+
-- The MongoDB Docs Team
52+

snooty.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name = "golang"
2+
title = "Go"
3+
toc_landing_pages = [
4+
"/fundamentals/connection",
5+
"/fundamentals/crud",
6+
"/fundamentals/builders"
7+
]
8+
9+
[constants]
10+
version = 4.0
11+
package-name-org = "mongodb-org"
12+
pgp-version = "{+version+}"

source/compatibility.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Compatibility
2+
-------------
3+
4+
MongoDB Compatibility
5+
~~~~~~~~~~~~~~~~~~~~~
6+
7+
The following compatibility table specifies the recommended version(s) of the
8+
MongoDB Go Driver for use with a specific version of MongoDB.
9+
10+
The first column lists the driver version(s).
11+
12+
.. include:: /includes/mongodb-compatibility-table-go.rst
13+
14+
Language Compatibility
15+
~~~~~~~~~~~~~~~~~~~~~~
16+
17+
The following compatibility table specifies the recommended version(s) of the
18+
MongoDB Go Driver for use with a specific version of Go.
19+
20+
The first column lists the driver version(s).
21+
22+
.. include:: /includes/language-compatibility-table-go.rst

source/faq.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
===
2+
FAQ
3+
===
4+
5+
.. default-domain:: mongodb
6+
7+
Frequently Asked Questions
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Lorem ipsum.

source/figures/M220J_hero.jpg

4.71 KB
Loading

source/figures/agg_factory.gif

993 KB
Loading

source/fundamentals.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
============
2+
Fundamentals
3+
============
4+
5+
.. default-domain:: mongodb
6+
7+
.. toctree::
8+
:titlesonly:
9+
:maxdepth: 1
10+
11+
12+
13+
..
14+
/fundamentals/connection
15+
/fundamentals/auth
16+
/fundamentals/enterprise-auth
17+
/fundamentals/databases-collections
18+
/fundamentals/data-formats
19+
/fundamentals/crud
20+
/fundamentals/indexes
21+
/fundamentals/aggregation
22+
/fundamentals/builders
23+
/fundamentals/collations
24+
/fundamentals/csfle
25+
/fundamentals/gridfs
26+
/fundamentals/logging
27+
/fundamentals/monitoring

source/fundamentals/aggregation.txt

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
===========
2+
Aggregation
3+
===========
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
Overview
14+
--------
15+
16+
Aggregation operations process data in your MongoDB collections and return computed results. MongoDB's Aggregation
17+
framework is modeled on the concept of data processing pipelines. Documents enter a multi-staged pipeline that
18+
transforms the documents into an aggregated result.
19+
20+
Another way to think of aggregation is like a car factory. Within the car factory is an assembly line, along which
21+
are assembly stations with specialized tools to do a specific job, like drills and welders. Raw parts enter the factory,
22+
which are then transformed and assembled into a finished product.
23+
24+
The **aggregation pipeline** is the assembly line, **aggregation stages** are the assembly stations, and
25+
**operator expressions** are the specialized tools.
26+
27+
Aggregation and Find Operations Compared
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
30+
Using ``find`` operations, you can:
31+
32+
- select *what* documents to return
33+
- select *what* fields to return
34+
- sort the results
35+
36+
Using ``aggregation`` operations, you can:
37+
38+
- perform all ``find`` operations
39+
- rename fields
40+
- calculate fields
41+
- summarize data
42+
- group values
43+
44+
Aggregation operations have some :manual:`limitations <core/aggregation-pipeline-limits/>` you must keep in mind:
45+
46+
- Returned documents must not violate the :manual:`BSON document size limit </reference/limits/#BSON-Document-Size>`
47+
of 16 megabytes.
48+
49+
- Pipeline stages have a memory limit of 100 megabytes by default. If required, you may exceed this limit by using
50+
the `allowDiskUse <https://mongodb.github.io/mongo-java-driver/4.2/apidocs/mongodb-driver-sync/com/mongodb/client/AggregateIterable.html#allowDiskUse(java.lang.Boolean)>`__
51+
method. TODO: Update the link here!!
52+
53+
.. important:: ``$graphLookup`` exception
54+
55+
The :manual:`$graphLookup </operator/aggregation/graphLookup/>` stage has a strict memory limit of 100 megabytes
56+
and will ignore ``allowDiskUse``.
57+

source/fundamentals/auth.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
=========================
2+
Authentication Mechanisms
3+
=========================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
In this guide, we show you how to authenticate with MongoDB using each
14+
**authentication mechanism** available in the MongoDB Community Edition.
15+
Authentication mechanisms are processes by which the driver and server
16+
confirm identity and establish trust to ensure security.
17+
18+
The mechanisms that you can use with the latest version of MongoDB Community
19+
Edition are as follows:
20+
21+
* Default
22+
* SCRAM-SHA-256
23+
* SCRAM-SHA-1
24+
* MONGODB-CR
25+
* MONGODB-AWS
26+
* X.509
27+
28+
To authenticate using ``Kerberos`` or ``LDAP``, see the
29+
:doc:`Enterprise Authentication Mechanisms guide </fundamentals/enterprise-auth>`.
30+
For more information on establishing a connection to your MongoDB cluster,
31+
read our :doc:`Connection Guide </fundamentals/connection>`.

source/fundamentals/collations.txt

Whitespace-only changes.

source/fundamentals/connection.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
================
2+
Connection Guide
3+
================
4+
5+
.. default-domain:: mongodb
6+
7+
.. toctree::
8+
9+
/fundamentals/connection/tls
10+
/fundamentals/connection/jndi
11+
12+
.. contents:: On this page
13+
:local:
14+
:backlinks: none
15+
:depth: 2
16+
:class: singlecol
17+
18+
This guide shows you how to connect to a MongoDB instance or replica set
19+
deployment using the driver.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
==============================
2+
Enable TLS/SSL on a Connection
3+
==============================
4+
5+
.. contents:: On this page
6+
:local:
7+
:backlinks: none
8+
:depth: 2
9+
:class: singlecol

source/fundamentals/crud.txt

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
===============
2+
CRUD Operations
3+
===============
4+
5+
.. default-domain:: mongodb
6+
7+
.. toctree::
8+
:caption: CRUD Operations
9+
10+
/fundamentals/crud/read-operations
11+
/fundamentals/crud/write-operations
12+
13+
CRUD (Create, Read, Update, Delete) operations enable you to work with
14+
data stored in MongoDB.
15+
16+
- :doc:`Read Operations </fundamentals/crud/read-operations>` find and return
17+
documents stored in your database.
18+
- :doc:`Write Operations </fundamentals/crud/write-operations>` insert, modify,
19+
or delete documents in your database.
20+
21+
..
22+
Some operations combine aspects of read and write operations. See our
23+
guide on :doc:`compound operations </fundamentals/crud/compound-operations>`
24+
to learn more about these hybrid methods.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
===============
2+
Read Operations
3+
===============
4+
5+
.. default-domain:: mongodb
6+
7+
- :doc:`/fundamentals/crud/read-operations/cursor`
8+
- :doc:`/fundamentals/crud/read-operations/sort`
9+
- :doc:`/fundamentals/crud/read-operations/limit`
10+
11+
..
12+
- :doc:`/fundamentals/crud/read-operations/retrieve`
13+
- :doc:`/fundamentals/crud/read-operations/skip`
14+
- :doc:`/fundamentals/crud/read-operations/project`
15+
- :doc:`/fundamentals/crud/read-operations/geo`
16+
- :doc:`/fundamentals/crud/read-operations/text`
17+
18+
.. toctree::
19+
:caption: Read Operations
20+
21+
/fundamentals/crud/read-operations/cursor
22+
/fundamentals/crud/read-operations/sort
23+
/fundamentals/crud/read-operations/limit
24+
..
25+
/fundamentals/crud/read-operations/skip
26+
/fundamentals/crud/read-operations/retrieve
27+
/fundamentals/crud/read-operations/project
28+
/fundamentals/crud/read-operations/geo
29+
/fundamentals/crud/read-operations/text
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=========================
2+
Access Data From a Cursor
3+
=========================
4+
5+
.. default-domain:: mongodb
6+
7+
Read operations that return multiple documents do not immediately return
8+
all values matching the query.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
====================================
2+
Limit the Number of Returned Results
3+
====================================
4+
5+
.. default-domain:: mongodb
6+
7+
Use ``limit()`` to cap the number of documents that a read operation returns.
8+
This instance method designates the maximum number of
9+
documents that a read operation can return. If there are not enough documents
10+
to reach the specified limit, it can return a smaller number.
11+
If you use ``limit()`` with the ``skip()`` (TODO: link) instance method, the skip applies
12+
first and the limit only applies to the documents left over after
13+
the skip.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
============
2+
Sort Results
3+
============
4+
5+
.. default-domain:: mongodb
6+
7+
Use ``sort()`` to change the order in which read operations return
8+
documents. The ``sort()`` instance method tells MongoDB to order returned documents by the
9+
values of one or more fields in a certain direction. To sort returned
10+
documents by a field in ascending (lowest first) order, use the static method ``Sorts.ascending()``,
11+
specifying the field on which to sort. To sort in descending (greatest first) order instead,
12+
use the static method ``Sorts.descending()``, specifying the field on which to sort. For example,
13+
you can sort on ``id`` or ``name`` fields. If you do not specify a sort, MongoDB does not
14+
guarantee the order of query results.

0 commit comments

Comments
 (0)