-
Notifications
You must be signed in to change notification settings - Fork 43
DOCSP-47273: FAQ reorg #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,12 @@ | |||||
Connect to MongoDB | ||||||
================== | ||||||
|
||||||
.. contents:: On this page | ||||||
:local: | ||||||
:backlinks: none | ||||||
:depth: 1 | ||||||
:class: singlecol | ||||||
|
||||||
.. facet:: | ||||||
:name: genre | ||||||
:values: reference | ||||||
|
@@ -200,3 +206,118 @@ class. Select the tab that corresponds to your preferred class. | |||||
.build(); | ||||||
MongoClient mongoClient = MongoClients.create(settings); | ||||||
|
||||||
ked Questions | ||||||
|
ked Questions | |
Frequently Asked Questions |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -591,4 +591,4 @@ to MongoDB: | |
:end-before: end SslSettings | ||
:language: java | ||
:emphasize-lines: 3-4 | ||
:dedent: | ||
:dedent: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a whitespace thing? Not a big deal if you can't get rid of it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'm not sure why this is showing up as edited |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,6 +206,48 @@ see the following API documentation: | |
- `getDefaultCodecRegistry() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.html?is-external=true#getDefaultCodecRegistry()>`__ | ||
- `fromProviders() <{+api+}/apidocs/bson/org/bson/codecs/configuration/CodecRegistries.html#fromProviders(org.bson.codecs.configuration.CodecProvider...)>`__ | ||
|
||
Frequently Asked Questions | ||
-------------------------- | ||
|
||
This section answers questions that may arise when storing | ||
POJOs in MongoDB. | ||
|
||
Do I have to specify an ID field value myself? | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
No, the ``PojoCodecProvider`` automatically generates an ObjectId. | ||
|
||
Can the ID field be a compound key? | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Yes. For an example of this, see `our implementation <https://github.com/niccottrell/mongo-java-tests/blob/master/src/test/PojoCompoundIdTest.java>`__ | ||
in Github. | ||
|
||
Can I use polymorphism in a POJO accessor? | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Yes, by using a discriminator. For more information, see the :ref:`Discriminators | ||
<pojo-discriminators>` section of the POJO Customization guide. | ||
|
||
Can I mix private, protected, and public setters and getters? | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
No. The native POJO codec assumes that getters and setters have the same | ||
modifiers for each field. | ||
|
||
For example, the following methods throws an exception during encoding: | ||
|
||
.. code-block:: java | ||
|
||
private String getField(); | ||
public String setField(String x); | ||
|
||
How do I fix: "org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class X."? | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This exception means you must register a codec for the class since | ||
none exist. | ||
|
||
Summary | ||
|
||
------- | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would set this to 2 on all the docs you touch for consistency