updated stringclasses 4
values | metadata dict | action stringclasses 1
value | sourceName stringclasses 4
values | body stringlengths 97 1.08k | url stringclasses 20
values | format stringclasses 1
value | title stringclasses 20
values | embedding listlengths 384 384 |
|---|---|---|---|---|---|---|---|---|
2024-05-20T17:32:23.500Z | {
"contentType": "Code Example",
"productName": null,
"tags": [
"Java",
"Spring"
],
"version": null
} | created | devcenter | As you can see, I’m using an auto-closeable try-with-resources which will automatically close the client session at the end. This helps me to keep the code clean and simple.
Some of you may argue that it is actually too simple because transactions (and write operations, in general) can throw exceptions, and I’m not ha... | https://www.mongodb.com/developer/code-examples/java/rest-apis-java-spring-boot | md | REST APIs with Java, Spring Boot, and MongoDB | [
-0.06570691615343094,
-0.00028689877944998443,
0.05140234902501106,
-0.04029842093586922,
0.01408341247588396,
-0.039414696395397186,
0.020902082324028015,
0.04618111252784729,
-0.016687754541635513,
-0.05932946503162384,
-0.021208424121141434,
-0.03566288203001022,
-0.007504936773329973,
... |
2024-05-20T17:32:23.500Z | {
"contentType": "Code Example",
"productName": null,
"tags": [
"Java",
"Spring"
],
"version": null
} | created | devcenter | Luckily, Spring provides the annotation `ExceptionHandler` to help us do that. See the code in my controller `PersonController`. Of course, you will need to adapt and enhance this in your real project, but you have the main idea here.
```java
@ExceptionHandler(RuntimeException.class)
public final ResponseEntity handle... | https://www.mongodb.com/developer/code-examples/java/rest-apis-java-spring-boot | md | REST APIs with Java, Spring Boot, and MongoDB | [
-0.06039218604564667,
0.0036323911044746637,
0.03805512934923172,
-0.040028877556324005,
0.011331590823829174,
-0.0352645181119442,
0.05585698410868645,
0.054624419659376144,
-0.028550488874316216,
-0.017760273069143295,
0.002833765931427479,
-0.03987063094973564,
0.04272453114390373,
0.05... |
2024-05-20T17:32:23.500Z | {
"contentType": "Code Example",
"productName": null,
"tags": [
"Java",
"Spring"
],
"version": null
} | created | devcenter | ```java
@Override
public double getAverageAge() {
List pipeline = List.of(group(new BsonNull(), avg("averageAge", "$age")), project(excludeId()));
return personCollection.aggregate(pipeline, AverageAgeDTO.class).first().averageAge();
}
```
Also, you can note here that I’m using the `personCollection` which was... | https://www.mongodb.com/developer/code-examples/java/rest-apis-java-spring-boot | md | REST APIs with Java, Spring Boot, and MongoDB | [
-0.03430325910449028,
0.004300291184335947,
-0.0027935784310102463,
-0.038299523293972015,
0.009678411297500134,
-0.027354616671800613,
0.037777598947286606,
0.026876822113990784,
-0.01637119986116886,
0.011425045318901539,
0.015342768281698227,
-0.0679003968834877,
0.03717166185379028,
0.... |
2024-05-20T17:32:23.500Z | {
"contentType": "Code Example",
"productName": null,
"tags": [
"Java",
"Spring"
],
"version": null
} | created | devcenter | ## Swagger
Swagger is the tool you need to document your REST APIs. You have nothing to do — the configuration is completely automated. Just run the server and navigate to http://localhost:8080/swagger-ui.html. the interface will be waiting for you.
for more information.
## Nyan Cat
Yes, there is a Nyan Cat sectio... | https://www.mongodb.com/developer/code-examples/java/rest-apis-java-spring-boot | md | REST APIs with Java, Spring Boot, and MongoDB | [
-0.051025472581386566,
0.0020606087055057287,
0.008362272754311562,
-0.01653616689145565,
0.04463132098317146,
0.00867606233805418,
-0.00596108753234148,
0.03738109767436981,
-0.02173328772187233,
-0.016612080857157707,
-0.005427626892924309,
-0.05795499309897423,
0.04639716446399689,
0.05... |
2024-05-20T17:32:23.500Z | {
"contentType": "Code Example",
"productName": null,
"tags": [
"Java",
"Spring"
],
"version": null
} | created | devcenter | ## Conclusion
I hope you like my template, and I hope I will help you be more productive with MongoDB and the Java stack.
If you see something which can be improved, please feel free to open a GitHub issue or directly submit a pull request. They are very welcome. :-)
If you are new to MongoDB Atlas, give our Quick S... | https://www.mongodb.com/developer/code-examples/java/rest-apis-java-spring-boot | md | REST APIs with Java, Spring Boot, and MongoDB | [
-0.0710957869887352,
0.011432668194174767,
-0.004561296198517084,
-0.005724127404391766,
0.02573459781706333,
-0.0029782771598547697,
0.010772356763482094,
0.0374654084444046,
-0.01542743295431137,
-0.02575158327817917,
-0.0037470050156116486,
-0.08644571900367737,
0.06435542553663254,
0.0... |
2024-05-20T17:32:23.500Z | {
"contentType": "News & Announcements",
"productName": null,
"tags": [
"Swift",
"MongoDB"
],
"version": null
} | created | devcenter | # Halting Development on MongoDB Swift Driver
MongoDB is halting development on our server-side Swift driver. We remain excited about Swift and will continue our development of our mobile Swift SDK.
We released our server-side Swift driver in 2020 as an open source project and are incredibly proud of the work that ou... | https://www.mongodb.com/developer/languages/swift/halting-development-on-swift-driver | md | Halting Development on MongoDB Swift Driver | [
-0.02048601023852825,
-0.010558489710092545,
0.035269901156425476,
-0.029257163405418396,
0.0026281876489520073,
-0.0030582291074097157,
-0.007431581616401672,
0.01594264805316925,
-0.02352409064769745,
-0.014450808987021446,
0.010975237935781479,
-0.026762347668409348,
0.023372916504740715,... |
2024-05-20T17:32:23.500Z | {
"contentType": "News & Announcements",
"productName": null,
"tags": [
"Swift",
"MongoDB"
],
"version": null
} | created | devcenter | Community members and developers are welcome to fork our existing driver and add features as you see fit - the Swift driver is under the Apache 2.0 license and source code is available on GitHub. For those developing client/mobile applications, MongoDB offers the Realm Swift SDK with real time sync to MongoDB Atlas.
W... | https://www.mongodb.com/developer/languages/swift/halting-development-on-swift-driver | md | Halting Development on MongoDB Swift Driver | [
-0.04201998934149742,
-0.036628011614084244,
0.021529875695705414,
-0.02369876578450203,
0.014935408718883991,
0.003615425433963537,
0.012501300312578678,
0.03791311755776405,
-0.027779564261436462,
-0.04076854884624481,
0.02252265438437462,
-0.03456484153866768,
0.0034513145219534636,
0.0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.