note 119967 added to mongocollection.aggregate
| From: | mike at eastghost dot com | Date: | Fri, 30 Sep 2016 08:23:13 +0000 |
| Subject: | note 119967 added to mongocollection.aggregate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206707@lists.php.net to get a copy of this message | ||
COPY ONE COLLECTION TO ANOTHER COLLECTION IN SAME DATABASE
db.myoriginal.aggregate( [ [ $match: [] ], [ $out: "mycopy" ] ] )
a LOT faster than doing many inserts in a forEach loop.
< 2 seconds to copy 50,000 documents each a few KB.
12GB of data in 1-2 minutes on a i5 PC.
Best part : it's non-blocking!
Target can't be a capped collection.
ymmv
----
Server IP: 72.52.91.14
Probable Submitter: 74.96.181.211
----
Manual Page -- http://php.net/manual/en/mongocollection.aggregate.php
Edit -- https://master.php.net/note/edit/119967
Del: integrated -- https://master.php.net/note/delete/119967/integrated
Del: useless -- https://master.php.net/note/delete/119967/useless
Del: bad code -- https://master.php.net/note/delete/119967/bad+code
Del: spam -- https://master.php.net/note/delete/119967/spam
Del: non-english -- https://master.php.net/note/delete/119967/non-english
Del: in docs -- https://master.php.net/note/delete/119967/in+docs
Del: other reasons-- https://master.php.net/note/delete/119967
Reject -- https://master.php.net/note/reject/119967
Search -- https://master.php.net/manage/user-notes.php