Created
April 19, 2014 05:06
-
-
Save mizchi/11074676 to your computer and use it in GitHub Desktop.
This file contains 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
db = new Momic.DB | |
name: 'app' | |
collections: | |
items: | |
itemType: String | |
name: String | |
value: Number | |
db.items.drop().then => | |
a = db.items.insert({ itemType: 'weapon', name: 'ひのきのぼう', value: 10}) | |
b = db.items.insert([ | |
{ itemType: 'weapon', name: 'てつのつるぎ', value: 50} | |
{ itemType: 'weapon', name: 'はがねのつるぎ', value: 120} | |
]) | |
Promise.all(a,b).then => | |
console.log db.items.count() #=> 3 | |
db.items.findOne({name: 'てつのつるぎ'}).done (item) => console.log item | |
db.items.find({value: {'$gte':30}}).done (items) => | |
db.drop({value: {'$gte':30}}).done (items) => console.log items | |
# db.items.remove(items).then => | |
console.log 'items that has value more thant 30 area removed' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment