• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Lytol/Mongo.jl: Mongo bindings for the Julia programming language

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Lytol/Mongo.jl

开源软件地址:

https://github.com/Lytol/Mongo.jl

开源编程语言:

Julia 100.0%

开源软件介绍:

Mongo.jl

MongoDB bindings for The Julia Language

Installing

You must have the Mongo C drivers installed, see https://github.com/mongodb/mongo-c-driver.

Getting Started

require("Mongo.jl")

using Mongo

client = MongoClient()   # Defaults to MongoClient("localhost", 27017)

# Insert a few documents
insert(client, "test.people", { "name" => "Brian", "age" => 30, "hobbies" => {"surfing", "coding", "video games"}})
insert(client, "test.people", { "name" => "Lizzie", "age" => 30, "hobbies" => {"traveling", "crafts", "movies"}})
insert(client, "test.people", { "name" => "Adam", "age" => 31, "hobbies" => {"climbing", "cycling"}})

# Find Brian
obj = find_one(client, "test.people", { "name" => "Brian" })

# Change his age to 31
update(client, "test.people", { "_id" => obj["_id"] }, { "\$set" => { "age" => 31 }})

# Change everyone's age to 30
update(client, "test.people", Dict(), { "\$set" => { "age" => 30 }}, MULTI)

# Change Adam back to 31
update(client, "test.people", { "name" => "Adam" }, { "\$set" => { "age" => 31 }})

# Find everyone's name and age and display
fields = { "name" => 1, "age" => 1 }

cursor = find(client, "test.people", Dict(), fields)

for o in cursor
    println("Name: " * o["name"] * " / Age: " * string(o["age"]))  # Or simply, println(o)
end

# Remove Lizze
remove(client, "test.people", { "name" => "Lizzie" })

# Actually, let's just remove everyone
remove(client, "test.people", Dict())

Development

Running the Test Suite

NOTE: MongoDB server must be running on localhost

  • cd to the project root and run the following: julia test/run.jl

Contributing

Fork and send a pull request or create a GitHub issue and I'll try and respond quickly




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap