anchor.diff:    mongo:update(Connection, Collection, {'_id', 100}, Command),
   
     %check data updated
  -  Res1 = find(Connection, Collection, {'_id', 100}),
  -  ?debugFmt("Got ~p", [Res1]),
  -  [{'_id', 100,
  -    sku, <<"abc123">>,
  -    quantity, 500,
  -    instock, true,
  -    reorder, false,
  -    details, {model, "14Q3", make, "xyz"},
  -    tags, ["coats", "outerwear", "clothing"],
  -    ratings, [{by, "ijk", rating, 4}]}] = Res1,
  +  [Res1] = find(Connection, Collection, {'_id', 100}),
  +  ct:log("Got ~p", [Res1]),
  +  true = is_equal_bsons(
  +           Res1,
  +           {'_id', 100,
  +            sku, <<"abc123">>,
  +            quantity, 500,
  +            instock, true,
  +            reorder, false,
  +            details, {model, "14Q3", make, "xyz"},
  +            tags, ["coats", "outerwear", "clothing"],
  +            ratings, [{by, "ijk", rating, 4}]}),
   
     %update non existent fields
     Command1 = {'$set', {expired, true}},
     mongo:update(Connection, Collection, {'_id', 100}, Command1),
   
     %check data updated
  -  Res2 = find(Connection, Collection, {'_id', 100}),
  -  ?debugFmt("Got ~p", [Res1]),
  -  [{'_id', 100,
  -    sku, <<"abc123">>,
  -    quantity, 500,
  -    instock, true,
  -    reorder, false,
  -    details, {model, "14Q3", make, "xyz"},
  -    tags, ["coats", "outerwear", "clothing"],
  -    ratings, [{by, "ijk", rating, 4}],
  -    expired, true}
  -  ] = Res2,
  +  [Res2] = find(Connection, Collection, {'_id', 100}),
  +  ct:log("Got ~p", [Res2]),
  +  true = is_equal_bsons(
  +           Res2,
  +           {'_id', 100,
  +            sku, <<"abc123">>,
  +            quantity, 500,
  +            instock, true,
  +            reorder, false,
  +            details, {model, "14Q3", make, "xyz"},
  +            tags, ["coats", "outerwear", "clothing"],
  +            ratings, [{by, "ijk", rating, 4}],
  +            expired, true}),
   
     %update embedded fields
     Command2 = {'$set', {'details.make', "zzz"}}, %TODO make bson avoid using atoms
     mongo:update(Connection, Collection, {'_id', 100}, Command2),
   
     %check data updated
  -  Res3 = find(Connection, Collection, {'_id', 100}),
  -  ?debugFmt("Got ~p", [Res1]),
  -  [{'_id', 100,
  -    sku, <<"abc123">>,
  -    quantity, 500,
  -    instock, true,
  -    reorder, false,
  -    details, {model, "14Q3", make, "zzz"},
  -    tags, ["coats", "outerwear", "clothing"],
  -    ratings, [{by, "ijk", rating, 4}],
  -    expired, true}
  -  ] = Res3,
  +  [Res3] = find(Connection, Collection, {'_id', 100}),
  +  ct:log("Got ~p", [Res3]),
  +  true = is_equal_bsons(
  +           Res3,
  +           {'_id', 100,
  +            sku, <<"abc123">>,
  +            quantity, 500,
  +            instock, true,
  +            reorder, false,
  +            details, {model, "14Q3", make, "zzz"},
  +            tags, ["coats", "outerwear", "clothing"],
  +            ratings, [{by, "ijk", rating, 4}],
  +            expired, true}),
   
     %update list elements
     Command3 = {'$set', { %TODO make bson avoid using atoms
  
positive.code: 
    %insert test data
    mongo:insert(Connection, Collection, [
      {name, <<"Yankees">>, home, {city, <<"New York">>, state, <<"NY">>}, league, <<"American">>},
      {name, <<"Mets">>, home, {city, <<"New York">>, state, <<"NY">>}, league, <<"National">>},
      {name, <<"Phillies">>, home, {city, <<"Philadelphia">>, state, <<"PA">>}, league, <<"National">>},
      {name, <<"Red Sox">>, home, {city, <<"Boston">>, state, <<"MA">>}, league, <<"American">>}
    ]),
  
    %test selector
    Res = find(Connection, Collection, {home, {city, <<"New York">>, state, <<"NY">>}}),
    ?debugFmt("Got ~p", [Res]),
    [{'_id', _,
      name, <<"Yankees">>, home,
      {city, <<"New York">>, state, <<"NY">>},
      league, <<"American">>},
      {'_id', _,
        name, <<"Mets">>, home,
        {city, <<"New York">>, state, <<"NY">>},
        league, <<"National">>}] = Res,
  
    %test projector
    Res2 = find(Connection, Collection, {home, {city, <<"New York">>, state, <<"NY">>}}, {name, true, league, true}),
    ?debugFmt("Got ~p", [Res2]),
    [{'_id', _,
      name, <<"Yankees">>,
      league, <<"American">>},
      {'_id', _,
        name, <<"Mets">>,
        league, <<"National">>}] = Res2,
    Config.
  
  sort_and_limit(Config) ->
  
negative.code: 
    %check data inserted
    Res = find(Connection, Collection, {'_id', 100}),
    ct:log("Got ~p", [Res]),
    [{'_id', 100,
      sku, <<"abc123">>,
      quantity, 250,
  