Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function run() {
// create database
const db = await RxDB.create({
name: 'mydb',
adapter: 'memory'
});
// create a collection
const mySchema = {
version: 0,
type: 'object',
properties: {
key: {
type: 'string',
primary: true
},
value: {
type: 'string'
}
async _init() {
// Only create db if it doesnt exist already
this.db = await RxDB.create({
name: this.name,
adapter: this.adapter,
multiInstance: false,
});
this.collection = await this._createCollection();
}
async createDatabase() {
// password must have at least 8 characters
const db = await RxDB.create(
{name: dbName, adapter: 'idb', password: '12345678'}
);
console.dir(db);
// show who's the leader in page's title
db.waitForLeadership().then(() => {
document.title = 'â™› ' + document.title;
});
// create collection
const messagesCollection = await db.collection({
name: 'messages',
schema: schema
});
// set up replication
export const createDb = async (options) => {
db = await RxDB.create(options)
window.RxDb = db
}
;(async function() {
const database: DaddaDatabase = await RxDB.create({
name: TR_VOCABULARY_STORE_KEY,
adapter: 'idb',
multiInstance: true
})
database.collection({
name: 'vocabulary',
schema: {
title: 'word',
version: 0,
type: 'object',
properties: {
text: {
type: 'string'
}
},
async createDatabase() {
const db = await RxDB.create({
name: dbName,
adapter: 'asyncstorage',
password: 'myLongAndStupidPassword',
multiInstance: false,
});
const heroCollection = await db.collection({
name: 'heroes',
schema,
});
heroCollection.sync({
remote: syncURL + dbName + '/',
options: {
live: true,
retry: true,
},
});