Created
July 6, 2014 22:03
-
-
Save cheptsov/e99e5fa7343143008b2b to your computer and use it in GitHub Desktop.
Kotlin NoSQL API for MongoDB has been rewritten to use RxJava (see https://github.com/cheptsov/kotlin-nosql for details):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get a document | |
Albums.find { details.artistId.equal(artistId) }.subscribe(onNext = { album -> | |
}, onError = { | |
}) | |
// Get selected fields of a document | |
Albums.find { id.equal(albumId) }.projection { sku + details.title + pricing }.subscribe(onNext = { | |
val (sku, title, pricing) = it | |
}, onError = { | |
}) | |
// Update selected fields of a document | |
Products.find { sku.equal("00e8da9b") }.projection { pricing.retail + pricing.savings + pricing.list }.update(1150, 50, 1250).subscribe(onComplete = { | |
}, onError = { | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment