- given the document like so
{
"_id": "abc123",
"name": "Jesse",
"username": "jchappell",
"location": "New York",
"score": 23| class DittoManager { | |
| let ditto: Ditto | |
| static let shared = DittoManager() | |
| init() { | |
| ditto = Ditto(identity: .onlinePlayground(appID: "e23ffe6b-70d1-4246-83a8-94cbd7a79a8d", token: "f058ac2a-4576-4af1-96f2-c4788d848cf8")) | |
| try! ditto.startSync() | |
| } |
| function checkSiteId(siteId: any): siteId is string { | |
| if (typeof siteId !== "string") { | |
| return false | |
| } | |
| if (siteId.trim().length === 0) { | |
| // it's just white space | |
| return false | |
| } |
| sudo apt-get update | |
| sudo apt-get -y upgrade | |
| sudo apt-get -y install vim tmux git build-essential libxml2-dev python2.7 python2.7-dev fuse libtool autoconf libusb-1.0-0-dev libfuse-dev libssl-dev libimobiledevice* usbmuxd |
If we had documents in the cars collection like this:
[
{
"_id": "123abc",| // A struct will show up as a class on the JS side of things | |
| extern crate wasm_bindgen; | |
| use wasm_bindgen::prelude::*; | |
| #[wasm_bindgen] | |
| pub struct Bar { | |
| contents: String, | |
| } |
| const options = { | |
| "provider": "nickname", | |
| "providerToken": "god", | |
| "userInfo": { | |
| "is_admin": true | |
| } | |
| }; | |
| const user = await Realm.Sync.User.registerWithProvider(`https://INSTANCE_ADDRESS`, options) |
| import * as Realm from 'realm'; | |
| import * as faker from 'faker' | |
| import * as _ from 'lodash' | |
| // Product | |
| export const ProductSchema: Realm.ObjectSchema = { | |
| name: 'Product', | |
| properties: { | |
| productId: 'string', | |
| name: 'string', |
| import { Server } from './' // import { Server } from 'realm-object-server' | |
| import * as faker from 'faker' | |
| import * as Realm from 'realm' | |
| const myNewServer = new Server({ | |
| port: 9081 | |
| }) | |
| myNewServer.start() | |
| .then(() => { | |
| console.log('Started! on port 9081') |
| import { Server } from './' // import { Server } from 'realm-object-server' | |
| import * as faker from 'faker' | |
| import * as Realm from 'realm' | |
| const myNewServer = new Server({ | |
| port: 9081 | |
| }) | |
| myNewServer.start() | |
| .then(() => { | |
| console.log('Started! on port 9081') |