Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-165

BCON Notation for insert key/value only when value meets condition

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 0.7
    • Affects Version/s: 0.6
    • Component/s: None
    • None

      Hi gjmurakami,

      BCON looks amazing, thanks for writing this! I see the potential of much clearer C code in our futures =).

      Looking at how we currently use libmongoc, it looks like we can't switch over to BCON because we have many places in our code where we test if the value passes a condition before we insert the key/value pair. Simple example:

      bson doc[1];
      bson_init(doc);
      bson_append_new_oid(doc, "_id");
      if (match != -1) bson_append_bool(doc, "match", match);
      if (domain != NULL) bson_append_string(doc, "dom", domain);
      if (user != NULL) bson_append_string(doc, "user", user);
      ...
      

      I wonder if it would be possible to somehow satisfy this use case as well. The BCON spec is nice and clean, and I don't really have a solution in mind that wouldn't clutter it up somehow. Some food for thought, I guess =).

      Sam

        1. bson-special-fun.diff
          10 kB
          Gary Murakami
        2. bson-special-q.diff
          4 kB
          Gary Murakami

            Assignee:
            gjmurakami Gary Murakami
            Reporter:
            schou@barracuda.com Samuel Chou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: