code: @SuppressWarnings("deprecation")
      public int getMaxBsonObjectSize() {
          List<ServerDescription> primaries = getClusterDescription().getPrimaries();
          return primaries.isEmpty() ? ServerDescription.getDefaultMaxDocumentSize() : primaries.get(0).getMaxDocumentSize();
      }
docs: Gets the maximum size for a BSON object supported by the current master server. Note that this value may change over time depending
  on which server is master.
  
  @return the maximum size, or 0 if not obtained from servers yet.
  @throws MongoException if there's a failure