mongo.create(rmongodb)
mongo.create()所属R语言包:rmongodb
Create an object of class "mongo"
创建一个对象类“蒙戈”
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Connect to a MongoDB server or replset and return an object of class "mongo" used for further communication over the connection.
连接到一个MongoDB的服务器或replset的的,并返回一个对象类“蒙戈”作进一步的沟通连接。
All parameters are stored as attributes of the returned mongo object. Note that these attributes only reflect the initial parameters. Only the external data pointed to by the "mongo" attribute actually changes if, for example, mongo.timeout is called after the initial call to mongo.create.
所有的参数都存储作为返回蒙戈对象的属性。请注意,这些属性反映的初始参数。只有外部的数据指出,通过“蒙戈”属性中,实际上改变,例如,mongo.timeout的被称为后的初始调用mongo.create。
用法----------Usage----------
mongo.create(host="127.0.0.1", name="",
username="", password="", db="admin", timeout=0L)
参数----------Arguments----------
参数:host
(string vector) A list of hosts/ports to which to connect. If a port is not given, 27017 is used.
(字符串向量)要连接到的主机/端口列表。如果没有给出端口,27017。
参数:name
(string) The name of the replset to which to connect. If name == "" (the default), the hosts are tried one by one until a connection is made. Otherwise, name must be the name of the replset and the given hosts are assumed to be seeds of the replset. Each of these is connected to and queried in turn until one reports that it is a master. This master is then queried for a list of hosts and these are in turn connected to and verified as belonging to the given replset name. When one of these reports that it is a master, that connection is used to form the actual connection as returned.
(字符串)的replset要连接到的名称。如果name ==“”(默认值),则主机尝试一个接一个,直到建立连接。否则,名称必须是的replset名称,并在给定的主机被假定为种子的replset。每个这些被连接到并反过来,直到有报告说,它是一个主质疑。主被查询的主机列表,这些都是连接到属于给定的replset名和验证。当其中的一个报告,它是一个高手,那是用来连接形成实际的连接返回。
参数:username
(string) The username to be used for authentication purposes. The default username of "" indicates that no user authentication is to be performed by the initial connect.
(字符串)用于认证目的的用户名。默认的“用户名”表示没有进行用户身份验证的初始连接。
参数:password
(string) The password corresponding to the given username.
(字符串)给定的用户名对应的密码。
参数:db
(string) The name of the database upon which to authenticate the given username and password. If authentication fails, the connection is disconnected, but mongo.get.err() will indicate not indicate an error.
(字符串)进行身份验证给定的用户名和密码的数据库的名称。如果身份验证失败,连接被断开,但是mongo.get.err()将显示不显示错误。
参数:timeout
(as.integer) The number of milliseconds to wait before timing out of a network operation. The default (0L) indicates no timeout.
(as.integer)的网络操作超时之前等待的毫秒数。默认情况下(0L)表示没有超时。
值----------Value----------
If successful, a mongo object for use in subsequent database operations; otherwise, mongo.get.err() may be called on the returned mongo object to see why it failed.
如果成功的话,一个的蒙戈对象为使用在随后的数据库操作;否则,mongo.get.err()调用返回的蒙戈对象,看看它为什么失败。
参见----------See Also----------
mongo,<br> mongo.is.connected,<br> mongo.disconnect,<br> mongo.reconnect,<br> mongo.get.err,<br> mongo.get.primary,<br> mongo.get.hosts,<br> mongo.get.socket,<br> mongo.set.timeout,<br> mongo.get.timeout.
蒙戈,参考mongo.is.connected,参考mongo.disconnect,参考mongo.reconnect,参考mongo.get.err,参考mongo.get.primary,参考mongo.get.hosts,参考mongo.get.socket,参考mongo.set.timeout,参考mongo.get.timeout。
实例----------Examples----------
mongo <- mongo.create()
## Not run: [#不运行:]
mongo <- mongo.create("192.168.0.3")
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|