-
Notifications
You must be signed in to change notification settings - Fork 88
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-14573): set data type #1079
Merged
mohammadhunan-dev
merged 27 commits into
mongodb:new-data-types-node-rn
from
mohammadhunan-dev:DOCSP-14573-Set-Data-Type
May 19, 2021
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e59b6ae
added set examples + bluehawked
b8be1d8
literal included set exampkes
10ef9db
added delete one set item example
ad8f25e
fix typo
b5322f9
added descriptions to set
5ddbb5f
fix grammar
62dae49
changed link + hunter to generic names
3030419
added capitalization to clearly define Realm Set as a term
179fdfc
fix wording + formatting"
e5baab5
clarified wording
1c4a3a3
fix literalincldue indentation
4a469f3
fix typo
15fbdb8
more wording fixes
81c94ad
clean up realm object model for set wording
55f6e4f
fix character names for examples
dc7d071
clarified traversal order wording
c5561b7
rst typo in <set>
5312d69
changed set to mySet
ac8a4ec
fix overview wording
cad7aec
updated overview to be more clear on differences between array
545a3c0
updated create wording
a2e8387
Update source/examples/generated/node/data-types.codeblock.remove-all…
2e37543
Update source/examples/generated/node/data-types.codeblock.remove-spe…
d6f993d
Update source/sdk/node/data-types/sets.txt
0114373
clarified that you can use spread operator to create array from set +…
5d8338d
fix grammar + wording + changed Set to Realm.Set in js snippets
b5edd4b
Fix woridng
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
source/examples/generated/node/data-types.codeblock.add-items-to-set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
realm.write(() => { | ||
characterOne.inventory.add("hammer"); | ||
characterOne.levelsCompleted.add(32); | ||
}); |
5 changes: 5 additions & 0 deletions
5
source/examples/generated/node/data-types.codeblock.check-if-set-has-items.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// check if the characterTwo has completed level 3 by calling the `Realm.Set.has()` method | ||
const characterTwoHasCompletedLevelThree = characterTwo.levelsCompleted.has(3); | ||
console.log( | ||
`Is level three completed by the characterTwo: ${characterTwoHasCompletedLevelThree}` | ||
); |
3 changes: 3 additions & 0 deletions
3
source/examples/generated/node/data-types.codeblock.check-set-size.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// check how many items the characterTwo has in his inventory through the `Realm.Set.size` property | ||
const characterTwoInventorySize = characterTwo.inventory.size; | ||
console.log(`The characterTwo has ${characterTwoInventorySize} inventory items`); |
15 changes: 15 additions & 0 deletions
15
source/examples/generated/node/data-types.codeblock.create-set-objects.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let characterOne, characterTwo; | ||
realm.write(() => { | ||
characterOne = realm.create("Character", { | ||
_id: new BSON.ObjectId(), | ||
name: "CharacterOne", | ||
inventory: ["elixir", "compass", "glowing shield"], | ||
levelsCompleted: [4, 9], | ||
}); | ||
characterTwo = realm.create("Character", { | ||
_id: new BSON.ObjectId(), | ||
name: "CharacterTwo", | ||
inventory: ["estus flask", "gloves", "rune"], | ||
levelsCompleted: [1, 2, 5, 24], | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
source/examples/generated/node/data-types.codeblock.define-set-objects.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const characterSchema = { | ||
name: "Character", | ||
primaryKey: "_id", | ||
properties: { | ||
_id: "objectId", | ||
name: "string", | ||
levelsCompleted: "int<>", | ||
inventory: "string<>", | ||
}, | ||
}; |
4 changes: 4 additions & 0 deletions
4
source/examples/generated/node/data-types.codeblock.remove-all-items-from-set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
realm.write(() => { | ||
// clear all data from the inventory slot of the characterTwo by calling `Realm.Set.clear()` in a write transaction | ||
characterTwo.inventory.clear(); | ||
}); |
4 changes: 4 additions & 0 deletions
4
source/examples/generated/node/data-types.codeblock.remove-specific-item-from-set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
realm.write(() => { | ||
// remove the compass from characterOne's inventory by calling `Realm.Set.delete()` within a write transaction | ||
characterOne.inventory.delete("compass"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spread operator (
...
) will also work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍