Doc #70326 [Opn]: Incorrect and incomplete list of log callbacks

From: Date: Sat, 22 Aug 2015 17:24:41 +0000
Subject: Doc #70326 [Opn]: Incorrect and incomplete list of log callbacks
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12638@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70326&edit=1 ID: 70326 User updated by: fgm at osinet dot fr Reported by: fgm at osinet dot fr Summary: Incorrect and incomplete list of log callbacks Status: Open Type: Documentation Problem Package: mongo Operating System: Linux PHP Version: 5.6.12 Block user comment: N Private report: N New Comment: Just to be sure the issue is clear, I think the result from the code is just as it should, what needs to be fixed is the manpage. Previous Comments: ------------------------------------------------------------------------ [2015-08-22 14:05:10] fgm at osinet dot fr Description: ------------ The MongoDB Context Options doc page at http://php.net/manual/en/context.mongodb.php omits two such working callbacks: - log_query, needed to log commands including $query - log_batchinsert, fto log batch inserts. And it mentions log_write_batch, which does not seem to exist, maybe an old name for log_batchinsert. By the docs, the sample script should call log_write_batch and not the other 2 loggers, but it calls them and not log_write_batch. See PHP test file tests/mongos/stream-logger-001.phpt Test script: --------------- <?php function log_batchinsert (array $server, array $docs, array $info, array $options) { echo "Batch Insert " . count($docs) . " documents.\n"; } function log_write_batch () { echo __METHOD__ . "\n"; } function log_query(array $server, array $criteria, array $queryOptions) { echo "Query: " . json_encode($criteria) . "\n"; } $context = stream_context_create([ 'mongodb' => ['log_batchinsert' => 'log_batchinsert', 'log_write_batch' => 'log_write_batch', 'log_query' => 'log_query'], ]); $server = 'mongodb://localhost:27017'; $client = new \MongoClient($server, [], ['context' => $context]); $collection = $client->selectDB('bug')->selectCollection('bug_collection'); $collection->drop(); $docs = [['foo' => 'bar'], ['baz' => 'quux']]; $result = $collection->batchInsert($docs); Expected result: ---------------- log_write_batch Actual result: -------------- Query: {"drop":"bug_collection"} Batch Insert 2 documents. Query: {"getlasterror":1} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70326&edit=1

« previous php.doc.bugs (#12638) next »