Like toString, is there any way to convert a string to a BSON object? I need to delete a document using the C ++ driver, the remove function expects the request to have a BSON object.
Use the fromjson method found here:
http://api.mongodb.org/cplusplus/1.5.4/namespacemongo.html#a4f542be0d0f9bad2d8cb32c3436026c2
BSONObj mongo::fromjson ( const string & str ) Create a BSONObj from a JSON <http://www.json.org> string.
In addition to the JSON extension extensions described here http://mongodb.onconfluence.com/display/DOCS/Mongo+Extended+JSON , this function accepts certain names without quotes and allows single quotes, if necessary, to be used when specifying field names and string values โโinstead of double quotes. Remote Unicode JSON sequences (forms) are converted to utf8.Exceptions: MsgAssertionException if parsing fails. The message contained in this statement includes: a rough indication of when the parsing failed.
In addition to the JSON extension extensions described here http://mongodb.onconfluence.com/display/DOCS/Mongo+Extended+JSON , this function accepts certain names without quotes and allows single quotes, if necessary, to be used when specifying field names and string values โโinstead of double quotes. Remote Unicode JSON sequences (forms) are converted to utf8.
Exceptions: MsgAssertionException if parsing fails. The message contained in this statement includes: a rough indication of when the parsing failed.
Source: https://habr.com/ru/post/905500/More articles:Result of dropping clusters with vector names - cluster-analysisAccess restriction in java - javasearchDisplayController does not display results if iphone is not English - iosMinimize text block size - windowsWhat is the cause of this error java.lang.IllegalStateException: trying to return an unknown connection2? - hibernateJava for exe a good or bad idea? - javaWould you wrap PDO or expand it? - phphow to determine which procedure to call events in delphi - delphiAccess to the / cache directory in the Android file system - androidLinq-to-entity, Generics and Precompiled Queries - genericsAll Articles