1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
<h2 id="quickStart">Quick Start</h2>
<p>
The recommended way to get started using one of the drivers in your project is with a dependency management system.
Select the driver, version and dependency management system below and the snippet can be copied and pasted into your build.
</p>
<p>
Alternatively, head over to our documentation to learn more about getting started with Java and MongoDB.
</p>
{{- range where $.Site.Data.releases.versions "version" $.Site.Data.releases.current -}}
{{- $.Scratch.Set "qs.currentReleasedVersion" . -}}
{{- end -}}
{{- $currentReleasedVersion := $.Scratch.Get "qs.currentReleasedVersion" -}}
<div id="downloadWidget">
<div class="container">
<div class="row downloadForm">
<form>
<div class="col-xs-5 col-lg-4 col-lg-push-2 ">
{{- $.Scratch.Set "qs.pos" 0 -}}
{{- $.Scratch.Set "qs.firstDriver" false -}}
{{- with $.Site.Data.releases.drivers -}}
<select class="driverPicker">
{{- range . -}}
{{- if eq ($.Scratch.Get "qs.firstDriver") false -}}
{{- $.Scratch.Set "qs.firstDriver" . -}}
{{- end -}}
<option value="{{$.Scratch.Get "qs.pos"}}" data-versions="{{.versions}}">{{.name}}</option>
{{- $.Scratch.Add "qs.pos" 1 -}}
{{- end -}}
</select>
{{- end -}}
</div>
<div class="col-xs-5 col-lg-4 col-lg-push-2 ">
{{- $.Scratch.Set "qs.pos" 0 -}}
{{- $firstDriver := $.Scratch.Get "qs.firstDriver" -}}
{{- with $.Site.Data.releases.versions -}}
<select class="releasePicker">
{{- range . -}}
<option value="{{$.Scratch.Get "qs.pos"}}" {{ if eq (in $firstDriver.versions .version) false }}disabled="disabled"{{else if eq .status "current"}}selected{{end}}>{{.version}}</option>
{{- $.Scratch.Add "qs.pos" 1 -}}
{{- end -}}
</select>
{{- end -}}
</div>
<div class="col-lg-2 col-lg-push-2 ">
<input type="checkbox" checked class="distroPicker" data-toggle="toggle" data-on="Maven" data-off="Gradle" data-offstyle="success">
</div>
</form>
<div class="hidden-md hidden-sm hidden-xs col-lg-2 col-lg-pull-10 downloadLink">
<a href="https://oss.sonatype.org/content/repositories/releases/org/mongodb/mongodb-driver/{{$currentReleasedVersion.version}}/"
id="downloadLink" class="btn btn-dark btn-download" target="_blank">Download</a>
</div>
</div>
<div class="row">
<div class="clipboard" title="copy">
<button class="btn btn-dark"><i class="fa fa-clipboard fa-2"></i></button>
</div>
{{- $currentNode := . -}}
{{- $.Scratch.Set "qs.firstDriver" true -}}
{{- with $currentNode.Site.Data.releases.drivers -}}
{{- $.Scratch.Set "qs.driverPos" 0 -}}
{{- range . -}}
{{- $currentDriver := . -}}
{{- with $.Site.Data.releases.versions -}}
{{- $.Scratch.Set "qs.versionPos" 0 -}}
{{- range . -}}
{{- $currentVersion := . -}}
{{- $firstDriver := $.Scratch.Get "qs.firstDriver" -}}
{{- $driverPos := $.Scratch.Get "qs.driverPos" -}}
{{- $versionPos := $.Scratch.Get "qs.versionPos" -}}
{{- if in $currentDriver.versions $currentVersion.version -}}
{{- if in $currentVersion.version "SNAPSHOT" -}}
<div id="maven-{{$versionPos}}-{{$driverPos}}" class="download {{if or (ne $firstDriver true) (ne $currentVersion.status "current") }} hidden{{end}}">
<pre><code>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>{{$currentDriver.name}}</artifactId>
<version>{{$currentVersion.version}}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>Sontatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</code></pre>
</div>
<div id="gradle-{{$versionPos}}-{{$driverPos}}" class="download hidden">
<pre><code>
dependencies {
compile 'org.mongodb:{{$currentDriver.name}}:{{$currentVersion.version}}'
}
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
</code></pre>
</div>
{{- else -}}
<div id="maven-{{$versionPos}}-{{$driverPos}}" class="download {{ if or (ne $firstDriver true) (ne $currentVersion.status "current") }} hidden{{end}}">
<pre><code>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>{{$currentDriver.name}}</artifactId>
<version>{{$currentVersion.version}}</version>
</dependency>
</dependencies>
</code></pre>
</div>
<div id="gradle-{{$versionPos}}-{{$driverPos}}" class="download hidden">
<pre><code>
dependencies {
compile 'org.mongodb:{{$currentDriver.name}}:{{$currentVersion.version}}'
}
</code></pre>
</div>
{{- end -}}
{{- if eq $currentVersion.status "current" -}}
{{- $.Scratch.Set "qs.firstDriver" false -}}
{{- end -}}
{{- $.Scratch.Add "qs.versionPos" 1 -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $driverPos := $.Scratch.Get "qs.driverPos" -}}
<div id="driver-{{$driverPos}}" class="download description{{if ne $driverPos 0}} hidden{{end}}">
{{- $currentDriver.description | markdownify -}}
</div>
{{- $.Scratch.Add "qs.driverPos" 1 -}}
{{- end -}}
{{- end -}}
</div>
</div>
</div>
|