ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.12.0
    • Affects Version/s: None
    • None
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?

      When specifying an encryptedFieldsMap in the configuration of the MongoDB Connection, the fields are automatically converted into the expected type for the schema.

      2. Would you like the user to see examples of the syntax and/or executable code and its output?

      http://github.com/mongodb/laravel-mongodb/blob/5.x/resources/boost/skills/laravel-mongodb/references/queryable-encryption.md

      3. Which versions of the driver/connector does this apply to?

      Laravel-MongoDB 5.12 (like other QE features of this epic)

      Show
      1. What would you like to communicate to the user about this feature? When specifying an encryptedFieldsMap in the configuration of the MongoDB Connection, the fields are automatically converted into the expected type for the schema. 2. Would you like the user to see examples of the syntax and/or executable code and its output? http://github.com/mongodb/laravel-mongodb/blob/5.x/resources/boost/skills/laravel-mongodb/references/queryable-encryption.md 3. Which versions of the driver/connector does this apply to? Laravel-MongoDB 5.12 (like other QE features of this epic)
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Automatic encryption encrypts a value according to the bsonType declared in the encryptedFieldsMap. Values that arrive as strings (HTTP form fields, JSON APIs, CSV imports) do not match the native BSON types int / long / double. For an encrypted field declared bsonType: "int" or bsonType: "double", a string such as "1500" must be coerced manually ((int), (float), a mutator, or a custom cast) before it is saved. With Queryable Encryption, a value that does not match the declared type is rejected by the driver or the server, so the coercion is required.

      This ticket proposes that laravel-mongodb cast attributes to the native BSON types declared in the encryptedFieldsMap, at least int, long, and double, so form and JSON strings become the expected type automatically rather than being stored as strings or rejected.

      Proposed approach

      • Derive an Eloquent cast from bsonType: int -> integer, double -> float, long -> int, date -> date, object -> array, bool -> boolean.
      • Apply it on write so the driver receives the native BSON type, not a string.
      • Surface conflicts with a user-declared cast on the same field.
      • Keep the existing read-side integer / float semantics.

      Related

      • Epic: PHPLARA-50. This is linked as a follow-up to that epic.

              Assignee:
              Jérôme Tamarelle
              Reporter:
              Jérôme Tamarelle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: