### Question:
AbstractMongoCollection implements MongoCollection<P> { Document convertSelectorToDocument(Document selector) { Document document = new Document(); for (String key : selector.keySet()) { if (key.startsWith("$")) { continue; } Object value = selector.get(key); if (!Utils.containsQueryExpression(value)) { Utils.changeSubdocumentValue(document, key, value, (AtomicReference<Integer>) null); } } return document; } protected  AbstractMongoCollection(MongoDatabase database, String collectionName, CollectionOptions options,
                                      CursorRegistry cursorRegistry); @Override void addDocument(Document document); @Override MongoDatabase getDatabase(); @Override String getCollectionName(); @Override String toString(); @Override void addIndex(Index<P> index); @Override void drop(); @Override void dropIndex(String indexName); @Override Document findAndModify(Document query); @Override QueryResult handleQuery(QueryParameters queryParameters); @Override List<Document> insertDocuments(List<Document> documents, boolean isOrdered); @Override Document handleDistinct(Document query); @Override int deleteDocuments(Document selector, int limit, Oplog oplog); @Override Document updateDocuments(Document selector, Document updateQuery, ArrayFilters arrayFilters,
                                    boolean isMulti, boolean isUpsert, Oplog oplog); @Override List<Index<P>> getIndexes(); @Override int count(Document query, int skip, int limit); @Override Document getStats(); @Override void removeDocument(Document document); @Override Document validate(); @Override void renameTo(MongoDatabase newDatabase, String newCollectionName);  }### Answer:
@Test void testConvertSelector() throws Exception { assertThat(collection.convertSelectorToDocument(json(""))) .isEqualTo(json("")); assertThat(collection.convertSelectorToDocument(json("_id: 1"))) .isEqualTo(json("_id: 1")); assertThat(collection.convertSelectorToDocument(json("_id: 1, $set: {foo: 'bar'}"))) .isEqualTo(json("_id: 1")); assertThat(collection.convertSelectorToDocument(json("_id: 1, 'e.i': 14"))) .isEqualTo(json("_id: 1, e: {i: 14}")); assertThat(collection.convertSelectorToDocument(json("_id: 1, 'e.i.y': {foo: 'bar'}"))) .isEqualTo(json("_id: 1, e: {i: {y: {foo: 'bar'}}}")); }