@Override public String toString() { return toJson(); }
/** * Gets a JSON representation of this document using the {@link org.bson.json.JsonMode#STRICT} output mode, and otherwise the default * settings of {@link JsonWriterSettings.Builder}. * * @return a JSON representation of this document * @see #toJson(JsonWriterSettings) * @see JsonWriterSettings */ @SuppressWarnings("deprecation") public String toJson() { return toJson(new JsonWriterSettings()); }
return value.asArray().toArray(); case DOCUMENT: return Document.parse(value.asDocument().toJson()); default: return value;
/** * Pretty-prints a Bson object. * * @param bson Bson object to be printed, may be {@code null}. * @return String representation of the Bson. */ public static String prettyPrint(@Nullable final Bson bson) { if (bson == null) { return NULL_STRING; } return toBsonDocument(bson).toJson(); }
@Override public String toString() { return asBsonDocument().toJson(); }
/** * Pretty-prints a Bson object. * * @param bson Bson object to be printed, may be {@code null}. * @return String representation of the Bson. */ public static String prettyPrint(@Nullable final Bson bson) { if (bson == null) { return NULL_STRING; } return toBsonDocument(bson).toJson(); }
/** * Construct a new instance * * @param code the javascript code * @param scope a bson document representing the scope */ public JavaScriptWithScope(final String code, final BsonDocument scope) { this(code, Assertions.notNull("scope", scope.toJson())); }
private Schema load( String schemaStoreDb, BsonValue schemaId) throws JsonSchemaNotFoundException { BsonDocument document = loadRaw(schemaStoreDb, schemaId); return SchemaLoader.load( new JSONObject(document.toJson()), new SchemaStoreClient()); }
return value.asArray().toArray(); case DOCUMENT: return Document.parse(value.asDocument().toJson()); default: return value;
@Override public QueryResult nativeGet(Query query, QueryOptions options) { Bson bson = parseQuery(query); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, options); }
@Override public QueryResult nativeGet(Query query, QueryOptions options) { Bson bson = parseQuery(query); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return postDBFiltering(query, mongoDBCollection.find(bson, options)); }
@Override public QueryResult nativeGet(Query query, QueryOptions options) { Bson bson = parseQuery(query); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return postDBFiltering(query, mongoDBCollection.find(bson, options)); }
@Override public QueryResult nativeGet(Query query, QueryOptions options) { Bson bson = parseQuery(query); QueryOptions parsedOptions = parseQueryOptions(options, query); parsedOptions = addPrivateExcludeOptions(parsedOptions, PRIVATE_CLINICAL_FIELDS); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()).toJson()); logger.debug("queryOptions: {}", options.toJson()); return mongoDBCollection.find(bson, parsedOptions); }
@Override public QueryResult<Variant> get(Query query, QueryOptions options) { Bson bson = parseQuery(query); QueryOptions parsedOptions = parseQueryOptions(options, query); parsedOptions = addPrivateExcludeOptions(parsedOptions, PRIVATE_CLINICAL_FIELDS); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()).toJson()); logger.debug("queryOptions: {}", options.toJson()); return mongoDBCollection.find(bson, null, Variant.class, parsedOptions); }
@Override public QueryResult<Variant> get(Query query, QueryOptions inputOptions) { Bson bson = parseQuery(query); // options.put(MongoDBCollection.SKIP_COUNT, true); // FIXME: patch to exclude annotation.additionalAttributes from the results - restore the call to the common // FIXME: addPrivateExcludeOptions as soon as the variation collection is updated with the new form of the // FIXME: additionalAttributes field QueryOptions options = addVariantPrivateExcludeOptions(new QueryOptions(inputOptions)); // options = addPrivateExcludeOptions(options); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, null, Variant.class, options); }
@Override public QueryResult get(Query query, QueryOptions inputOptions) { Bson bson = parseQuery(query); QueryOptions options = addPrivateExcludeOptions(new QueryOptions(inputOptions)); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, null, Repeat.class, options); }
@Override public QueryResult<RegulatoryFeature> get(Query query, QueryOptions inputOptions) { Bson bson = parseQuery(query); QueryOptions options = addPrivateExcludeOptions(new QueryOptions(inputOptions)); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, null, RegulatoryFeature.class, options); }
@Override public QueryResult<Variant> get(Query query, QueryOptions inputOptions) { Bson bson = parseQuery(query); // options.put(MongoDBCollection.SKIP_COUNT, true); // FIXME: patch to exclude annotation.additionalAttributes from the results - restore the call to the common // FIXME: addPrivateExcludeOptions as soon as the variation collection is updated with the new form of the // FIXME: additionalAttributes field QueryOptions options = addVariantPrivateExcludeOptions(new QueryOptions(inputOptions)); // options = addPrivateExcludeOptions(options); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, null, Variant.class, options); }
@Override public QueryResult nativeGet(Query query, QueryOptions inputOptions) { Bson bson = parseQuery(query); QueryOptions options = addPrivateExcludeOptions(new QueryOptions(inputOptions)); logger.debug("query: {}", bson.toBsonDocument(Document.class, MongoClient.getDefaultCodecRegistry()) .toJson()); return mongoDBCollection.find(bson, options); }
@Override public String generateResponse(MetricRegistry registry) throws IOException { BsonDocument document = MetricsJsonGenerator .generateMetricsBson(registry, TimeUnit.SECONDS, TimeUnit.MILLISECONDS); return document.toJson( JsonWriterSettings.builder() .outputMode(JsonMode.RELAXED) .indent(true) .build() ); } },