Linq2Fire
Supports special operators: IN, NOT IN, OR, !=, startsWith (^=), array-contains (has) and many more
;const db = firebase; const printDocs = { console; docs; console;}; const test = async { const $todos = ; await $todos ; await $todos; // add single doc await $todos; // add multiple docs await $todos; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; // await $todos // .where({ // 'category array_contains': 'A' // }) // .get() // .then(printDocs('Finding task using array_contains operator')); // get task names await $todos ; // join all items using pipe await $todos ; // convert task names to uppercase await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; await $todos ; // support pagination const pagination = $todos ; await pagination ; await pagination next ; await pagination next ;}; ;
References:
linq2fire(db):LinqDb
Create a linq object to wrap db
LinqDb.from(collectionName): LinqCollection
Create a linq object to wrap collection
LinqDb.from(collection, callback): LinqDb
Create a linq object to wrap collection, then pass it to callback. This method is useful for chaining calls
linq2fire(collection): LinqCollection
Create a linq object to wrap collection
LinqCollection.select(fieldName1: String, fieldName2: String, ...): LinqCollection
Projects each item of a result set into a new object with specific fields.
LinqCollection.select(fieldMap: Object): LinqCollection
Projects each item of a result set into a new object with specific fields.
LinqCollection.select(valueOnly: Boolean, field: String): LinqCollection
Transform result set into a array of field value
LinqCollection.select(customSelector: Function(data: Object, doc: DocumentSnapshot)): LinqCollection
Projects each item of a result set by using custom selector.
LinqCollection.limit(count): LinqCollection
Limit result set
LinqCollection.where(conditions): LinqCollection
Filter result set by multiple conditions { text: 'abc', 'age >': 100, fieldValueMustBeIn: [1, 2, 3, 4, 5], 'field <>': 0 } Support operators: >, <, >=, <=, =, ==, ===, <>, !=, !==, has, array-contains. 'has' is shorthand of 'array-contains'
LinqCollection.orderBy(fields): LinqCollection
Sort result set by specified fields { field1: 'asc', field2: 'desc' }
LinqCollection.get(options): Promise
Get all documents which is satisfied query condition
LinqCollection.next(options): Promise
Get next result set which starts after last result set
LinqCollection.set(docsOrData, applyToResultSet): Promise
LinqCollection.update(docsOrData, applyToResultSet): Promise
LinqCollection.remove(): Promise
Remove all documents which is satisfied query condition