问题描述
在哪里可以找到mongodb-erlang用法的例子?我发现的唯一的信息来源是这个文件:
但是它没有涵盖许多基本的查询,如下所示(从MongoDB网站中挑选):
db.collection.find()。sort({name:1,age:-1})。limit 10);
db.users.find()。skip(20).limit(10);
db.things.ensureIndex({j:1});
db.things.find({colors:{$ ne:red}});
db.collection.find({field:{$ gte:value}});
db.things.find({xa:1,xb:{$ gt:1}})
所以如何用erlang驱动程序编写这些查询?
对于官方支持的驱动程序API记录在这里:
对于查找操作,请查看函数索引,具体来说:
如果这不是你的口味,你可能还想查看社区驱动程序: / p>
emongo / erlmongo - 他们各自的自述文件和文档也有一些例子:
Where i can find examples of mongodb-erlang usage ?The only source of information i found is this file:https://github.com/TonyGen/mongodb-erlang/blob/master/src/mongodb_tests.erlBut it not covers many of basic queries like following (picked from MongoDB site):
db.collection.find().sort({name : 1, age: -1}).limit(10);
db.users.find().skip(20).limit(10);
db.things.ensureIndex({j:1});
db.things.find({colors : {$ne : "red"}});
db.collection.find({ "field" : { $gte: value } } );
db.things.find( { "x.a" : 1, "x.b" : { $gt : 1 } } )
So how to write these queries in terms of erlang driver ?
For the officially supported driver the API is documented here:
http://api.mongodb.org/erlang/mongodb/
For the find operations check out the function index, specifically:
http://api.mongodb.org/erlang/mongodb/mongo.html#find-2
If that is not to your taste, you may want to also check out the community drivers:
emongo/erlmongo - their respective READMEs and docs have some examples too:
https://bitbucket.org/rumataestor/emongo
https://github.com/wpntv/erlmongo
这篇关于mongodb-erlang Erlang司机示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!