In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about the example analysis of MongoDB in R language. Many people may not understand it very well. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
R Sword MongeDB, divided into four chapters.
MongoDB environment preparation
Rmongodb function library
Basic operation of rmongodb
Rmongodb test case
Each chapter is divided into a "text description section" and a "code section" to keep the text description consistent with the code.
1. MongoDB environment preparation
Text description part:
First of all, the environment is prepared. Here I choose the 32-bit desktop version of Linux Ubuntu operating system 12.04. you can choose the convenient Linux according to your usage habits.
The MongoDB installation process is skipped.
View the MongoDB server environment
Use the mongod command to start MongoDB.
Process number: pid=2924
Port: port=27017
Data file directory: dbpath=/data/db/
Software version: 32-bit
Hostname: host=conan
Use the mongo command to open mongo shell.
Simple operation of mongo shell:
View the database, switch the database, view the dataset.
R language environment 2.15.0 WinXP accesses Mongodb Server through remote connection.
Code part:
View the operating system
~ uname-a
Linux conan 3.2.0-38-generic-pae # 61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686 i686 i386 GNU/Linux
~ cat / etc/issue
Ubuntu 12.04.2 LTS\ n\ l
Start mongodb
~ mongod
Mongod-help for help and startup options
Thu Apr 11 11:02:26
Thu Apr 11 11:02:26 warning: 32-bit servers don't have journaling enabled by default. Please use-- journal if you want durability.
Thu Apr 11 11:02:26
Thu Apr 11 11:02:26 [initandlisten] MongoDB starting: pid=2924 port=27017 dbpath=/data/db/ 32-bit host=conan
Thu Apr 11 11:02:26 [initandlisten]
Thu Apr 11 11:02:26 [initandlisten] * * NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Apr 11 11:02:26 [initandlisten] * * see http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Apr 11 11:02:26 [initandlisten] * * with-journal, the limit is lower
Thu Apr 11 11:02:26 [initandlisten]
Thu Apr 11 11:02:26 [initandlisten] db version v2.0.6, pdfile version 4.5
Thu Apr 11 11:02:26 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7bb49fb05bc
Thu Apr 11 11:02:26 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen # 1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_41
Thu Apr 11 11:02:26 [initandlisten] options: {}
Thu Apr 11 11:02:26 [websvr] admin web console waiting for connections on port 28017
Thu Apr 11 11:02:26 [initandlisten] waiting for connections on port 27017
Open mongo shell
~ mongo
MongoDB shell version: 2.0.6
Connecting to: test
Enter mongo shell and list the database
> show dbs
Db 0.0625GB
Feed 0.0625GB
Foobar 0.0625GB
Local (empty)
Switch database
> use foobar
Switched to db foobar
List display dataset
> show collections
Blog
System.indexes
R language development environment 2.15.0 WinXP
~ r
R version 2.15.0 (2012-03-30)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)
2. Rmongodb function library
Text description part:
Rmongodb has developed a large number of functions corresponding to the operation of mongo. Compared with other NoSQL, it is really a huge project. But I always feel that the encapsulation granularity is not enough, and it is more complicated to write code.
All the rmongodb function libraries are listed below, and I'll just pick a few commonly used introductions.
Establish a mongo connection
Mongo
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.