4.0.0 Branch
When a query is created and mango-functions are done on it, it should return a new RxQuery each time without transforming the old one.
Currently:
const query1 = myCol.find().sort('name');
const query2 = query1.limit(2);
console.log(query1 == query2);
// true
Wanted:
const query1 = myCol.find().sort('name');
const query2 = query1.limit(2);
console.log(query1 == query2);
// false
- Requires
Immutable Querys
When 2 equal RxQuery's are created, RxDB should ensure they are the equal object. To do this, querys should be saved in a WeakMap and if exists, the query should be taken from it.
Currently:
const query1 = myCol.find().sort('name');
const query2 = myCol.find().sort('name');
console.log(query1 == query2);
// false
Wanted:
const query1 = myCol.find().sort('name');
const query2 = myCol.find().sort('name');
console.log(query1 == query2);
// true
- Requires
Query-Cache
When a ChangeEvent
is fired on the collection, the query should detect if it is necessary to re-exec() or if the changeEvent does not affect the querys result.
Wanted:
const sub = myCol.find().sort('name').$;
myDocument.age = 4;
await myDocument.save();
// query should not re-exec since a change in age does not affect the result
// but the query$ should refire the documents again
myDocument.name = 'foobar';
await myDocument.save();
// query should re-exec since a change in age does affect the result
Pouchdb requires the developer to solve conflicts manually. A solution is to introduct a new keyword to the RxSchema conflictStrategy Here it is describe what should happen when a document-conflict happens. There should be the following default-strategies: first-insert-wins last-insert-wins lexical-ordering of the documents-hash It should also be possible to define custom resolution-strategies.
Things that will be implemented into version 3.0.0.
When v3.0.0 is done, all features which require breaking changes, will be implemented. This means you can then use RxDB in production without the fear breaking your clients database-state.
ORM-like function assignment.
const col = await myDatabase.collection({
name: 'heroes',
methods: {
doSomething: function(){
console.log('AAAH!');
}
}
});
// laster
const doc = await col.findOne().exec();
doc.doSomething();
// > 'AAAH!'
DONE