Title: Page 98 – Alex Kirk

---

 * 
   ## 󠀁[Restoring single objects in mongodb](https://alex.kirk.at/2011/05/31/restoring-single-objects-in-mongodb/)󠁿
   
 * May 31, 2011
 * Today I had the need to restore single objects from a [mongodb](http://www.mongodb.org/)
   installation. mongodb offers two tools for this mongodump and mongorestore, both
   of which seem to be designed to **only dump and restore whole collections**.
 * So I’ll demonstrate the workflow just to restore a bunch of objects. Maybe it’s
   a clumsy way, but we’ll improve this over time.
 * So, we have an existing backup, done with mongodump (for example through a daily,
   over-night backup). This consists of several .bson files, one for each collection.
    1. Restore a whole collection to a new database: mongorestore -d newdb collection.
       bson
    2. Open this database: mongo newdb
    3. Find the items you want to restore through a query, for example: db.collection.
       find({"_id": {"$gte": ObjectId("4da4231c747359d16c370000")}});
    4. Back on the command line again, just dump these lines to a new bson file: mongodump-
       d newdb -c collection -q '{"_id": {"$gte": ObjectId("4da4231c747359d16c370000")}}'
    5. Now you can finally import just those objects into your existing collection:
       mongorestore -d realdb collection.bson
 * [Code](https://alex.kirk.at/category/code/), [Mongodb](https://alex.kirk.at/category/code/mongodb/)
 * 
   ## 󠀁[Safari Extension: Clean URLs](https://alex.kirk.at/2011/03/30/safari-extension-clean-urls/)󠁿
   
 * March 30, 2011
 * I have been picking up and developing a fork of [Grant Heaslip’s](http://github.com/grantheaslip)
   Safari extension [URL clenser](http://github.com/akirk/url_cleanser) which removes
   all sorts of un-necessary junk for the URL so that you can **easily pass on a
   clean URL** to someone else. Things being removed include:
    - Google Analytics parameters (utm_source=, utm_medium, etc.)
    - Youtube related parameters (feature=)
    - Partner tracking stuff for NYTimes, Macword, CNN, CBC Canada and The Star
 * You can download my version here: [url_cleanser.safariextz](https://alex.kirk.at/wp-content/uploads/sites/2/2011/03/url_cleanser.safariextz)
 * [Web](https://alex.kirk.at/category/web/)

 [Previous Page](https://alex.kirk.at/page/97/?output_format=md&term_id=1122) [Next Page](https://alex.kirk.at/page/99/?output_format=md&term_id=1122)