mongoc_client_command_with_opts(), mongoc_database_command_with_opts(), and other command functions MONGOC_ERROR_QUERY MONGOC_ERROR_SERVER mongoc_collection_count_with_opts() mongoc_client_get_database_names_with_opts(), and other command helper functions MONGOC_ERROR_QUERY MONGOC_ERROR_SE...
collection := client.Database("user").Collection("wyc")opts := options.Update().SetUpsert(true)filter := bson.D{{"name", "aaa"}}update := bson.D{{"$set", bson.D{{"email", "aaa@example.com"}}}result, err := collection.UpdateOne(context.TODO(), filter, update, opts)if err !
- mongoc_collection_count_documents - mongoc_collection_estimated_document_count * Support for SCRAM-SHA-256 authentication, including support for non-ASCII passwords using libicu is an optional dependency. * Faster mongoc_database_get_collection_names_with_opts fetches only names, not the...
staticvoidtest_create_collection(void){mongoc_database_t*database;mongoc_collection_t*collection;mongoc_client_t*client;bson_error_terror = {0};bson_toptions;bson_tstorage_opts;bson_twt_opts;char*dbname;char*name;boolr; client =mongoc_client_new(gTestUri); assert (client); dbname = gen...
/* If the query hash is empty, don't include it in the count. as * we do for MongoCollection::count(); however, if the user * somehow stores a non-hash as the query (e.g. via addOption), * include it as-is and allow the server to raise an error. */ if ((Z_TYPE_PP(...
* we do for MongoCollection::count(); however, if the user * somehow stores a non-hash as the query (e.g. via addOption), * include it as-is and allow the server to raise an error. */ if ((Z_TYPE_PP(query) != IS_ARRAY && Z_TYPE_PP(query) != IS_OBJECT) || zend_hash...
db.$cmd.count( query = {}, <optional params> ) - count the number of documents that matches the query, optional parameters are: limit, skip, hint, maxTimeMS db.$cmd.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied. ...
=nil{panic(err)}err=mongo.WithSession(ctx,sess,func(sessionContext mongo.SessionContext)error{coll:=newCollection(client)find(sessionContext,coll,insertId)returnnil})}funcsingleSessionTest(){ctx:=context.TODO()client:=newClient()opts:=options.Session().SetDefaultReadConcern(readconcern.Majority())....
collation: opts[:collation] )opts = Keyword.drop(opts, ~w(limit skip hint collation)a)# Mongo 2.4 and 2.6 returns a float with {:ok, doc} <- command(topology_pid, query, opts), do: {:ok, trunc(doc["n"])} end@doc false @spec count!(GenServer.server(), collection, BSON....
collection.expects(:find).with({ "_id" => document.id }).returns(query) query.expects(:update).with( collection.should_receive(:find).with({ "_id" => document.id }).and_return(query) query.should_receive(:update).with( { "$push" => { "addresses" => address.raw_attributes }} ...