title: Fetch Specific key value pairs from mongodb collection with golang
body: <p>I want to fetch specific key value pairs from mongodb collection with golang dynamically.</p>
  
  <pre><code>err := collection.Find(operations).Limit(2).All(&amp;products)
  </code></pre>
  
  <p>How I can do it but it must be dynamically, because the select key value pairs are changing on my side:</p>
  
  <p>Collection document:</p>
  
  <pre><code>{
      "_id" : 168,
      "entity_id" : "168",
      "type_id" : "simple",
      "attribute_set_id" : "24",
      "entity_type_id" : "4",
      "created_at" : "2013-10-31 14:51:18",
      "has_options" : "0",
      "required_options" : "0",
      "sku" : "AIC-19000-16",
      "updated_at" : "2016-11-22 21:04:46",
      "base_type" : 154,
      "table_shape" : 164,
      "manufacturer" : 15,
      "delivery" : "Free Delivery &amp; Setup",
      "visibility" : 4,
      "tax_class_id" : 2,
      "status" : 1,
      "enable_googlecheckout" : 1,
      "discontinued" : 0,
      "featured_fme" : 0,
      "featured_product" : 0,
      "amxnotif_hide_alert" : 1,
      "is_recurring" : 0,
      "condition" : 3043,
      "ships" : null,
      "ignore_wisepricer" : 0,
      "fedexable" : null,
      "dropshipped" : 0,
      "verified_by" : 3301,
      "reward_point_product" : null,
      "mw_reward_point_sell_product" : null,
      "ashley_sale" : 0,
      "disable_amazonpayments" : 0,
      "for_configurables" : null,
      "rfm" : 0,
      "mk_stockmessage" : false,
      "mk_hideshipdate" : 0,
      "reviews_counter" : 0,
      "mpn" : "19000-16",
      "name" : "After Eight Titanium Leg Rectangular Dining Table",
      "style" : "73",
      "furniture_type" : "76",
      "meta_title" : "After Eight Titanium Leg Rectangular Dining Table, 
      19000-16, Aico Furniture",
      "meta_description" : "After Eight Titanium Leg Rectangular Dining 
      Table from Aico Furniture, 19003-88",
      "options_container" : "container2",
      "url_key" : "after-eight-titanium-leg-rectangular-dining-table",
      "url_path" : "after-eight-titanium-leg-rectangular-dining- 
      table.htm",
      "gallery" : "/9/19000-16_d1.jpg, /9/19000-16_d2.jpg, /9/19000- 
      16_d3.jpg, /9/19000-16_d4.jpg, /9/19000-16_d5.jpg, /9/19000- 
      16_d6.jpg, /9/19000-16_d7.jpg,",
      "image" : "/a/f/after8-silo-4legrecdin-sm-19000-16.jpg",
      "small_image" : "/a/f/after8-silo-4legrecdin-sm-19000-16.jpg",
      "thumbnail" : "/a/f/after8-silo-4legrecdin-sm-19000-16.jpg",
      "image_label" : null,
      "small_image_label" : null,
      "thumbnail_label" : null,
      "table_height" : "2640,2642",
      "dining_type" : "2645",
      "product_listing_ads" : "Aico Furniture",
      "carton_dimensions" : null,
      "msrp_enabled" : "2",
      "msrp_display_actual_price_type" : "4",
      "set_includes" : null,
      "custom_design" : null,
      "page_layout" : null,
      "gift_message_available" : null,
      "color" : "3553",
      "clearance" : null,
      "rfm_type" : null,
      "mk_stocktext" : null,
      "mk_ships_in" : null,
      "mk_preordertext" : null,
      "jet_product_status" : "not_uploaded",
      "meta_keyword" : "After Eight Titanium Leg Rectangular Dining 
      Table, 19000-16, Aico Furniture, dining room, dining, dining room 
      furniture, Leg Rectangular Dining Table, After Eight Titanium, 
      Modern, Wood, Light Colors, amini furniture, michael amini, 
      amini,",
      "description" : "",
      "short_description" : "",
      "features" : "Part of After Eight Collection &lt;br /&gt;Titanium Finish 
      &lt;br /&gt;Hollywood Regency Style &lt;br /&gt; Bold tonal contrasts and fun 
      geometric shapes &lt;br /&gt;Design that blends the best of many styles 
      &lt;br /&gt;Uniquely customizable look &lt;br /&gt;Bold splashes of color 
      &amp;amp; striking patterned accessories &lt;br /&gt;Includes 2- 24\" 
      Extension Leaves &lt;br /&gt;Table Extends from 74\" to 122\" &lt;br 
      /&gt;Mirrored glass inserts in the top &lt;br /&gt;Platinum accents &lt;br 
      /&gt;Also available in Pearl &lt;br /&gt; Optional Chairs&lt;br /&gt;Table Only, 
      Chairs Sold Separately&lt;br /&gt;",
      "dimensions" : "4 Leg Rectangular Dining Table: 127.50\"W x 45\"D 
      x 31\"H - 290lbs. &lt;br /&gt;Optional Side Chair: 21.50\"W x 26\"D x 
      45.75\"H - 24lbs. &lt;br /&gt;Optional Arm Chair: 23.75\"W x 26\"D x 
      45.75\"H - 28lbs. &lt;br /&gt;",
      "custom_layout_update" : null,
      "upc" : null,
      "cost" : 999.0,
      "price" : 2849.0,
      "tier_price_for_bundle" : 2279.2,
      "weight" : 290.0,
      "regularprice" : 2629.0,
      "special_price" : null,
      "msrp" : null,
      "estimated_shipping" : null,
      "estimated_set_shipping" : null,
      "family_rating_summary" : 0.0,
      "news_from_date" : null,
      "news_to_date" : null,
      "special_from_date" : null,
      "special_to_date" : null,
      "custom_design_from" : null,
      "custom_design_to" : null,
      "mk_expecdate" : null,
      "mk_preorderdate" : null,
  }
  </code></pre>
  
  <p>I want to select below key values:</p>
  
  <p>This is the format in which these keys come with me:</p>
  
  <pre><code>map[2: 3:manufacturer 8:upc 12:weight 15: 0:name 5:short_description 
  6:sku 13:category 1: 4:manufacturer 9:image 10:url 
  16:product_listing_ads 7:mpn 11:final_price 14:mapping:1]
  </code></pre>
  
  <p>Thanks for your help.</p>