private Document mergeConjunctions(List<Document> conjunctions) {
      final Multimap<String, Document> merged = LinkedHashMultimap.create();

      for (Document doc : conjunctions) {
        Preconditions.checkState(doc.keySet().size() == 1, "Invalid constraint %s", doc);
        final String key = doc.keySet().iterator().next();
        merged.put(key, doc);
      }

      final Document result = new Document();

      for (Map.Entry<String, Collection<Document>> entry : merged.asMap().entrySet()) {
        Preconditions.checkState(!entry.getValue().isEmpty(), "empty constraint: %s", entry);

        if (entry.getValue().size() == 1) {
          result.putAll(entry.getValue().iterator().next());
        } else {
          result.putAll(new Document(QueryOperators.AND, entry.getValue()));
        }
      }

      return result;
    }
Builds bson with index definition. The difference with
{@link #convertToBson(Constraints.ConstraintHost)} is that this method fails on duplicate
fields. Currently only one index is allowed per field.
@see <a href="https://docs.mongodb.com/manual/indexes/">Mongo Indexes</a>
mongo/src/org/immutables/mongo/repository/internal/Support.java