Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaikyulotus/dart-mongo-lite
A very light MongoDBLite library, at very basic development stage.
https://github.com/kaikyulotus/dart-mongo-lite
dart dartlang database json mongodb
Last synced: 24 days ago
JSON representation
A very light MongoDBLite library, at very basic development stage.
- Host: GitHub
- URL: https://github.com/kaikyulotus/dart-mongo-lite
- Owner: KaikyuLotus
- License: bsd-3-clause
- Created: 2020-03-22T14:39:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-25T09:52:41.000Z (about 3 years ago)
- Last Synced: 2024-10-01T16:40:02.508Z (about 1 month ago)
- Topics: dart, dartlang, database, json, mongodb
- Language: Dart
- Homepage:
- Size: 28.3 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Dart Mongo Lite
Dart Mongo Lite is a library which emulates MongoDB in a very simple way.\
It doesn't require any server setup, data will be saved on a local file (specified in Database constructor).\
It's not optimized for huge quantity of data.## Usage
A simple usage example:
```dart
void main() {
var db = Database('resources/db.json');var dialogsCollection = db['dialogs'];
var triggersCollection = db['triggers'];print('Dropped ${dialogsCollection.drop()} dialogs');
print('Dropped ${triggersCollection.drop()} triggers');dialogsCollection.insertMany([
{'dialog': 'Hello!', 'id': 1},
{'dialog': 'Hi!', 'id': 0}
]);
triggersCollection.insertMany([
{'trigger': 'Hello', 'id': 1},
{'trigger': 'Hi', 'id': 0}
]);triggersCollection.update({'id': 0}, {'trigger': 'Hiii trigger!'});
dialogsCollection.update({'id': 1}, {'dialog': 'Hiii dialog!'});var dialog = dialogsCollection.findOneAs(
(d) => Dialog.fromJson(d),
filter: {'dialog': 'Hiii dialog!'},
);
print(dialog?.dialog);var trigger = triggersCollection.findOneAs(
(t) => Trigger.fromJson(t),
filter: {'trigger': 'Hiii trigger!'},
);
}
```