-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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]>
- Loading branch information
Mohammad Hunan Chughtai
and
Mohammad Hunan Chughtai
authored
May 11, 2021
1 parent
b79ffbc
commit 2475974
Showing
5 changed files
with
138 additions
and
1 deletion.
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
20 changes: 20 additions & 0 deletions
20
source/examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.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,20 @@ | ||
realm.write(() => { | ||
// create a Dog with a birthDate value of type string | ||
realm.create("Dog", { name: "Euler", birthDate: "December 25th, 2017" }); | ||
|
||
// create a Dog with a birthDate value of type date | ||
realm.create("Dog", { | ||
name: "Blaise", | ||
birthDate: new Date("August 17, 2020"), | ||
}); | ||
// create a Dog with a birthDate value of type int | ||
realm.create("Dog", { | ||
name: "Euclid", | ||
birthDate: 10152021, | ||
}); | ||
// create a Dog with a birthDate value of type null | ||
realm.create("Dog", { | ||
name: "Pythagoras", | ||
birthDate: null, | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
source/examples/generated/node/data-types.codeblock.define-mixed-in-schema.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,7 @@ | ||
const DogSchema = { | ||
name: "Dog", | ||
properties: { | ||
name: "string", | ||
birthDate: "mixed", | ||
}, | ||
}; |
4 changes: 4 additions & 0 deletions
4
source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.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 @@ | ||
// To query for Blaise's birthDate, filter for his name to retrieve the realm object. | ||
// Use dot notation to access the birthDate property. | ||
let blaiseBirthDate = realm.objects("Dog").filtered(`name = 'Blaise'`)[0].birthDate; | ||
console.log(`Blaise's birth date is ${blaiseBirthDate}`); |
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