Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(DOCSP-35259) Add Map data type docs #3163

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

krollins-mdb
Copy link
Collaborator

@krollins-mdb krollins-mdb commented Jan 25, 2024

Pull Request Info

Jira ticket: https://jira.mongodb.org/browse/DOCSP-35259
Staged changes:

  • Data Types: Add new documentation for the RealmMap data type, which supports native Dart maps.

Reminder Checklist

Before merging your PR, make sure to check a few things.

  • Did you tag pages appropriately?
    • genre
    • meta.keywords
    • meta.description
  • Describe your PR's changes in the Release Notes section
  • Create a Jira ticket for related docs-app-services work, if any

Release Notes

  • Flutter SDK
    • Realm Database/Model Data/Data Types: Add new documentation for the RealmMap data type, which supports native Dart maps.

Review Guidelines

REVIEWING.md

Animal Wearing a Hat

Copy link

github-actions bot commented Jan 25, 2024

Readability for Commit Hash: d50bd67

You can see any previous Readability scores (if they exist) by looking
at the comment's history.

Readability scores for changed documents:

  • source/sdk/flutter/realm-database/model-data/data-types: Grade Level: 8.2, Reading Ease: 58.69

For Grade Level, aim for 8 or below.

For Reading Ease scores, aim for 60 or above:

Score Difficulty
90-100 Very Easy
80-89 Easy
70-79 Fairly Easy
60-69 Medium
50-59 Fairly Hard
30-49 Hard
0-29 Very Hard

For help improving readability, try Hemingway App.

@krollins-mdb krollins-mdb marked this pull request as ready for review January 25, 2024 23:03
Copy link
Collaborator

@cbullinger cbullinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions but overall lgtm

``````````````````````````

You can add a ``RealmMap`` to your Realm Object schema by defining a property as
type ``RealmMap<T>`` where ``T`` can be any :ref:`supported Realm data type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since keys must be strings, aren't you defining a RealmMap<String, T?>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're right!


Realm objects can contain maps of any supported data type.
Realm uses the :flutter-sdk:`RealmList <realm/RealmMap-class.html>` data type
to store the data. Map keys may not contain ``.`` or start with ``$``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is percent encoding a map key allowed in Dart? From Kotlin page

// Percent encode . or $ characters to use them in map keys
val mapKey = "Hundred Acre Wood.Northeast"
val encodedMapKey = "Hundred Acre Wood%2ENortheast"

Copy link
Collaborator Author

@krollins-mdb krollins-mdb Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so, but only in the values, not the keys.

I take it back. Tested and percent-encoding works in map keys.

RealmMap
~~~~~~~~

Realm objects can contain maps of any supported data type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't each map a key-value pair? and only the mapped values can be non-string (i.e. any supported type)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. You're right. I've reworded this paragraph.

@krollins-mdb krollins-mdb merged commit 4cbb25b into mongodb:master Jan 30, 2024
6 checks passed
@krollins-mdb krollins-mdb deleted the DOCSP-35259 branch January 30, 2024 22:10
@docs-builder-bot
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants