marioreggiori / Objectdb
Licence: mit
Persistent embedded document-oriented NoSQL database for Dart and Flutter.
Stars: ✭ 173
Programming Languages
dart
5743 projects
Projects that are alternatives of or similar to Objectdb
Griddb
GridDB is a next-generation open source database that makes time series IoT and big data fast,and easy.
Stars: ✭ 1,587 (+817.34%)
Mutual labels: database, nosql
Databazel
The analytical and reporting solution for MongoDB
Stars: ✭ 118 (-31.79%)
Mutual labels: database, nosql
Unqlite
An Embedded NoSQL, Transactional Database Engine
Stars: ✭ 1,583 (+815.03%)
Mutual labels: database, nosql
Summitdb
In-memory NoSQL database with ACID transactions, Raft consensus, and Redis API
Stars: ✭ 1,295 (+648.55%)
Mutual labels: database, nosql
Arangodb
🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.
Stars: ✭ 11,880 (+6767.05%)
Mutual labels: database, nosql
Cog
A Persistent Embedded Graph Database for Python
Stars: ✭ 90 (-47.98%)
Mutual labels: database, nosql
Couchbase Lite Ios
Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps.
Stars: ✭ 1,532 (+785.55%)
Mutual labels: database, nosql
Ardb
A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
Stars: ✭ 1,707 (+886.71%)
Mutual labels: database, nosql
Ftserver Cs
Lightweight iBoxDB Full Text Search Server for C#
Stars: ✭ 81 (-53.18%)
Mutual labels: database, nosql
Gkvdb
[mirror] Go语言开发的基于DRH(Deep-Re-Hash)深度哈希分区算法的高性能高可用Key-Value嵌入式事务数据库。基于纯Go语言实现,具有优异的跨平台性,良好的高可用及文件IO复用设计,高效的底层数据库文件操作性能,支持原子操作、批量操作、事务操作、多表操作、多表事务、随机遍历等特性。
Stars: ✭ 109 (-36.99%)
Mutual labels: database, nosql
Tidis
Distributed transactional NoSQL database, Redis protocol compatible using tikv as backend
Stars: ✭ 1,182 (+583.24%)
Mutual labels: database, nosql
Ejdb
🏂 EJDB 2.0 — Embeddable JSON Database engine C library. Simple XPath like query language (JQL). Websockets / Android / iOS / React Native / Flutter / Java / Dart / Node.js bindings. Docker image.
Stars: ✭ 1,187 (+586.13%)
Mutual labels: database, nosql
Jnosql
Eclipse JNoSQL is a framework which has the goal to help Java developers to create Jakarta EE applications with NoSQL.
Stars: ✭ 145 (-16.18%)
Mutual labels: database, nosql
ObjectDB
Persistent embedded document-oriented NoSQL database for Dart and Flutter. 100% Dart.
Check out objectdb_flutter for reactive store listeners.
If you notice any bugs you can create an issue on GitHub. You're also welcome to contribute using pull requests. Please open an issue before spending time on any pull request.
How to use
final path = Directory.current.path + '/my.db';
// create database instance and open
final db = ObjectDB(FileSystemStorage(path));
// insert document into database
db.insert({'name': {'first': 'Some', 'last': 'Body'}, 'age': 18, 'active': true});
db.insert({'name': {'first': 'Someone', 'last': 'Else'}, 'age': 25, 'active': false});
// update documents
db.update({Op.gte: {'age': 80}}, {'active': false});
// remove documents
db.remove({'active': false});
// search documents in database
var result = await db.find({'active': true, 'name.first': 'Some'});
// cleanup the db file
db.cleanup();
// close db
await db.close();
Storage types
// Universal (non-persistent)
import 'package:objectdb/src/objectdb_storage_in_memory.dart';
InMemoryStorage();
// Persist on filesystem (Flutter Mobile & Desktop)
import 'package:objectdb/src/objectdb_storage_filesystem.dart';
FileSystemStorage();
// Persist in IndexedDB (Flutter Web)
import 'package:objectdb/src/objectdb_storage_indexeddb.dart';
IndexedDBStorage(dbName);
Flutter
Check out the example project.
Methods
-
Future<void> db.cleanup()
cleanup the db file -
Future<void> db.close()
closes database (should be awaited to ensure all queries have been executed)
find
-
Future<List<Map>> db.find(Map query)
List with all matched documents -
Future<Map> db.first(Map query)
first matched document -
Future<Map> db.last(Map query)
last matched document
insert
-
Future<ObjectId> db.insert(Map document)
insert single document -
Future<List<ObjectId>> db.insertMany(List<Map> documents)
insert many documents
update
-
Future<int> db.update(Map query, Map changes, [bool replace = false])
update documents that machquery
withchanges
(optionally replace whole document)
remove
-
Future<int> db.remove(Map query)
remove documents that matchquery
Query
// Match fields in subdocuments
{Op.gte: {
'birthday.year': 18
}}
// or-operator
{Op.or: {
'active': true,
Op.inList: {'group': ['admin', 'moderator']}
}}
// not equal to
{Op.not: {'active': false}}
NOTE Querying arrays is not supportet yet.
Operators
Logical
-
and
(default operator on first level) or
not
Comparison
-
lt
,lte
: less than, less than or equal -
gt
,gte
: greater than, greater than or equal -
inList
,notInList
: value in list, value not in list
Modify
-
set
: set value -
max
,min
: set max or min int value -
increment
,multiply
: increment/multiply by -
unset
: unset key/value -
rename
: rename key - todo:
push
/pull
{Op.set: {'path.to.key': 'value'}} // set entry['path']['to']['key'] = 'value' (path will be created if not exists)
{Op.max: {'path.to.key': 200}} // set value 200 if value is greater than 200
{Op.min: {'path.to.key': 200}} // set value 200 if value is smaller than 200
{Op.increment: {'path.to.key': -5}} // increment value by negative 5
{Op.multiply: {'path.to.key': 2}} // multiply value by 2
{Op.unset: {'path.to.key': true}} // unset key/value at entry['path']['to']['key'] if exists
{Op.rename: {'path.to.key': 'new_key'}} // new value will be at entry['path']['to']['new_key']
db.update({
'age': RegExp('[18-20]'),
Op.gt: {'duration': 500},
}, {
Op.max: {'stats.score': 100},
Op.increment: {'stats.level': -5},
});
Examples
// query
var result = db.find({
'active': true,
Op.or: {
Op.inList: {'state': ['Florida', 'Virginia', 'New Jersey']},
Op.gte: {'age': 30},
}
});
// same as
var match = (result['active'] == true && (['Florida', 'Virginia', 'New Jersey'].contains(result['state']) || result['age'] >= 30));
License
See License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].