Skip to content

Commit f43ae61

Browse files
Mohammad Hunan ChughtaiMohammad Hunan Chughtaidacharycknethnathan-contino-mongo
authored
Node and React Native Data Types (#1065)
* New data types node rn (#1040) * new data types for node * added data types to TOC Co-authored-by: Mohammad Hunan Chughtai <[email protected]> * fixed refs for node.js data types * update doc * Remove accidental changes * added empty test file * (DOCSP-15613): Added Node.js field types (#1041) * Added node.js field types * fixed wording * fixed typo * fix typo in mdn urls * added additional data types * fix monospace err Co-authored-by: Mohammad Hunan Chughtai <[email protected]> * (DOCSP-15613): Node.js collections type (#1044) * Add content to Node.js > Data Types > Collections.txt * Removed unneeded spacing * clean up collections page + add headers * Filled out collections page * fix refs * fix typo * Update source/sdk/node/data-types/collections.txt * Update source/sdk/node/data-types/collections.txt * Update source/sdk/node/data-types/collections.txt Co-authored-by: Dachary <[email protected]> * fix rst * fix woridng * added ref * removed unneeded word * removed unneeded word * added period Co-authored-by: Mohammad Hunan Chughtai <[email protected]> Co-authored-by: Dachary <[email protected]> * (DOCSP-15613): Node.js embedded objects type (#1047) * Added documentation of Node.js embedded objects under data types * clean up relationships and embedded objects * added CRUD examples for embedded obj * added bluehawked examples * fix rst syntax highlight + add description for deletes * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt * Update source/sdk/node/data-types/embedded-objects.txt Co-authored-by: Mohammad Hunan Chughtai <[email protected]> * Docsp 14569 mixed data type (#1064) * attempt to add bluehawked mixed example snippets * fixed wording * Update source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js * Update examples/node/Examples/data-types.js Co-authored-by: Mohammad Hunan Chughtai <[email protected]> * (DOCSP-14565): Dictionary data type (#1058) * (DOCSP-14565): Dictionary Data Type - Node.js * added unit tested + bluehawked dictionary examples * Update examples/node/package.json * removed unneeded file * Added new examples for dictionaries * update dictionary examples * fix capitalization * moved addlistener down * fix comment * update wording to be clearer on type usage in dict * fix wording * fix wording Co-authored-by: Mohammad Hunan Chughtai <[email protected]> * (DOCSP-14577): UUID (#1067) * bump realmjs to 10.5.0-beta-1 * removed uuid as it's own page and added a subsection on it * added uuid bluehawked snippet + readded uuid to toc * added uuid examples * removed uuid from field types as a paragraph * update wording * update wording * fix passive voice * add specific uuid example * removed innacurate collections are homogenous (per mixed) * (DOCSP-14573): set data type (#1079) * added set examples + bluehawked * literal included set exampkes * added delete one set item example * fix typo * added descriptions to set * fix grammar * changed link + hunter to generic names * added capitalization to clearly define Realm Set as a term * fix wording + formatting" * clarified wording * fix literalincldue indentation * fix typo * more wording fixes * clean up realm object model for set wording * fix character names for examples * clarified traversal order wording * rst typo in <set> * changed set to mySet * fix overview wording * updated overview to be more clear on differences between array * updated create wording * Update source/examples/generated/node/data-types.codeblock.remove-all-items-from-set.js Co-authored-by: Kenneth Geisshirt <[email protected]> * Update source/examples/generated/node/data-types.codeblock.remove-specific-item-from-set.js Co-authored-by: Kenneth Geisshirt <[email protected]> * Update source/sdk/node/data-types/sets.txt Co-authored-by: Kenneth Geisshirt <[email protected]> * fix grammar + wording + changed Set to Realm.Set in js snippets * Fix woridng Co-authored-by: Kenneth Geisshirt <[email protected]> * fill out field types * add react native data types as a copy of node data types * add data types to toc * fix rn mixed links * attempt to add realm-js links * more grammar and woridng fixes * wording fixes * Update source/sdk/node/data-types/uuid.txt Co-authored-by: nate contino <[email protected]> * change uuid note on rn to match node * added note about obj id to both rn and node * Update source/sdk/node/data-types/mixed.txt Co-authored-by: nate contino <[email protected]> * fix 'mixed' formatting on rn to match node * change monospace to bold * fix spacing errors * fix wording * correct supported types for mixed * wording update Co-authored-by: Mohammad Hunan Chughtai <[email protected]> Co-authored-by: Dachary <[email protected]> Co-authored-by: Kenneth Geisshirt <[email protected]> Co-authored-by: nate contino <[email protected]>
1 parent 4e9f44a commit f43ae61

File tree

46 files changed

+2255
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2255
-310
lines changed

examples/node/Examples/data-types.js

Lines changed: 431 additions & 0 deletions
Large diffs are not rendered by default.

examples/node/package-lock.json

Lines changed: 355 additions & 250 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"jest": "^26.5.3",
2626
"prettier": "^2.1.2",
2727
"random-email": "^1.0.3",
28-
"realm": "^10.0.1",
28+
"realm": "^10.5.0-beta.1",
2929
"ts-jest": "^26.4.1",
3030
"typescript": "^4.0.3"
3131
},
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
summerHillHouse.addListener((changedHouse, changes) => {
2+
console.log("A change has occurred to the Summer Hill House object");
3+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
realm.write(() => {
2+
characterOne.inventory.add("hammer");
3+
characterOne.levelsCompleted.add(32);
4+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// check if the characterTwo has completed level 3 by calling the `Realm.Set.has()` method
2+
const characterTwoHasCompletedLevelThree = characterTwo.levelsCompleted.has(3);
3+
console.log(
4+
`Is level three completed by the characterTwo: ${characterTwoHasCompletedLevelThree}`
5+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// check how many items the characterTwo has in his inventory through the `Realm.Set.size` property
2+
const characterTwoInventorySize = characterTwo.inventory.size;
3+
console.log(`The characterTwo has ${characterTwoInventorySize} inventory items`);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// create an embedded address object
2+
const sydneyOrthodontics = {
3+
street: "42 Wallaby Way",
4+
city: "Sydney",
5+
country: "Australia",
6+
postalCode: "2774",
7+
};
8+
realm.write(() => {
9+
// create a contact object
10+
realm.create("Contact", {
11+
_id: new BSON.ObjectId(),
12+
name: "Philip Sherman",
13+
address: sydneyOrthodontics, // embed the address in the contact object
14+
});
15+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
realm.write(() => {
2+
// create a Dog with a birthDate value of type string
3+
realm.create("Dog", { name: "Euler", birthDate: "December 25th, 2017" });
4+
5+
// create a Dog with a birthDate value of type date
6+
realm.create("Dog", {
7+
name: "Blaise",
8+
birthDate: new Date("August 17, 2020"),
9+
});
10+
// create a Dog with a birthDate value of type int
11+
realm.create("Dog", {
12+
name: "Euclid",
13+
birthDate: 10152021,
14+
});
15+
// create a Dog with a birthDate value of type null
16+
realm.create("Dog", {
17+
name: "Pythagoras",
18+
birthDate: null,
19+
});
20+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
let johnDoe;
2+
let janeSmith;
3+
realm.write(() => {
4+
johnDoe = realm.create("Person", {
5+
name: "John Doe",
6+
home: {
7+
windows: 5,
8+
doors: 3,
9+
color: "red",
10+
address: "Summerhill St.",
11+
price: 400123,
12+
},
13+
});
14+
janeSmith = realm.create("Person", {
15+
name: "Jane Smith",
16+
home: {
17+
address: "100 northroad st.",
18+
yearBuilt: 1990,
19+
},
20+
});
21+
});

0 commit comments

Comments
 (0)