Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
12. åæå var NeDB = require(ânedb'); var db = new NeDB({ filename: 'path/to/datafile' }); 13. åæåï¼è¤æ°ãã¡ã¤ã«ã®å ´åï¼ var NeDB = require(ânedbâ); var db = {}; var db.users = new NeDB({ filename: 'path/to/userfile' }); var db.items = new NeDB({ filename: 'path/to/itemfile' });
from requests_oauthlib import OAuth1Session from requests.exceptions import ConnectionError, ReadTimeout, SSLError import json, datetime, time, pytz, re, sys,traceback, pymongo #from pymongo import Connection # Connection classã¯å»æ¢ãããã®ã§MongoClientã«å¤æ´ from pymongo import MongoClient from collections import defaultdict import numpy as np KEYS = { # èªåã®ã¢ã«ã¦ã³ãã§å ¥æãããã¼ãä¸è¨ã«è¨è¼ 'consumer_key':'**********', '
ãã®ãããªè¡¨ãä½ããã¨ã§ãä¾ãã°ä»¥ä¸ã®ãã¨ããããã¾ãã çµè·¯002ã¯æµå ¥æ°ã®å²ã«ç²å¾å¹çãç¿æ¥ç¶ç¶çãæªãããããæ¹åãããµã¼ãã¹ãã°ãã¹ã§ããããã çµè·¯003ã¯ç²å¾å¹çã¨ç¿æ¥å®ççãè¯ããä½ãè¯ãã®ããããã«åæããã°ãä»ã®æµå ¥çµè·¯ã®æ¹åã«çãããã Action2ã¯ç¿æ¥ç¶ç¶çã«è¯ãçµæãä¸ãã¦ããå¯è½æ§ããããããå°ã詳ãã調ã¹ã¦ã¿ããã ãã®ããã«ã¦ã¼ã¶ã¼ã®æ´»æ§åã¯æµå ¥çµè·¯å¥ã«åæããããã¨ã§ãåé¡ç¹ããã£ã³ã¹ãæµ®ã彫ãã«ãããã¨ãã§ãã¾ãã ä»åã¯ãã®è¡¨ãä½ãããã«ãã°åæãè¡ãã¾ãã ããã¾ã§ã§åæã®ã¹ã¿ã¼ãå°ç¹ã¨ã´ã¼ã«å°ç¹ããããã¾ããã ãã¨ã¯ãã®éã®éãã¤ãªãããã«ããã°ã©ã ãæ¸ãã ãã§ãã 次ã®ç« ã§ã¯ãMongoDBã§ã®åæãè¡ãããã®æºå段éãç´¹ä»ãã¾ãã åæï¼æºåç·¨ï¼ ããã§ã¯åæã®æºåç·¨ã¨ãã¦ããµã¼ãã¼ãã°ããã¦ã³ãã¼ããã¦ãã¦ãæ´å½¢ãã¦ãMongoDBã«ç»é²
Mogodbéè¨ MongoDBã®éè¨æ©è½ã便å©éãã¦æ³£ãã¦ããã話ã - Yuta.Kikuchiã®æ¥è¨ 1æç¨åã«MongoDBã使ã£ãéè¨æ©è½ã®ç´¹ä»ãããã¦ããã ãã@yutakikucã§ããå 容ã¯å ¨ã大ããäºç¡ãã£ãã®ã§ãããã¿ã¤ãã«ã§èªå°ãå¼ã£å¼µã£ã¦200è¿ãbookmarkãéããäºãã§ãã¾ããç¬ãã¿ãªããã®åèã«ãã¦ããã ãããã¨ã大å¤å¬ããæãã¾ããä»æ¥ã¯MongoDBã®éè¨ãããä¸æ©è¸ã¿è¾¼ãã å 容ãç´¹ä»ãã¦è¡ãããã¨æãã¾ããé¡æã¨ãã¦ã¯Aggregation Frameworkã¨MapReduceã«ã¤ãã¦ã§ããå ã«ä»å試ãã¦ã¿ãMongoDB-Versionã¯2.2.3ã§ããVersionã«ãã£ã¦æåãå¤ããã¨æãã®ã§æ³¨æãã¦ãã ããã $ mongo --version MongoDB shell version: 2.2.3 Aggregation Framewor
ï¼â»æ³¨ï¼2012å¹´å½æã®è¨äºã®ããå 容ã¯ããªãå¤ãã§ãããã¤ãæ¸ãç´ãããã»ã»ã»ï¼ 2012å¹´ãã¹ã¿ã¼ããã¦æ©5æ¥ã ãã£ããã®å¿æ©ä¸è»¢ã®ãã£ã³ã¹ã ããä½ãæ°ããæè¡ãè¦ãã¦ã¿ããã¨æããWebSocket ã®åå¼·ããã¦ã¿ããã¨ã«ãã¾ããã æ¢ã«ãåç¥ã®æ¹ãå¤ãã¨æãã¾ãããWebSocket ã¨ã¯ãã©ã¦ã¶ä¸ã§ Web ãµã¼ãã¨ã®åæ¹åéä¿¡ãå¯è½ã«ããè¦æ ¼ã®ãã¨ã§ã HTML5 ã¨ã¨ãã«ãWeb ã¢ããªã±ã¼ã·ã§ã³ãããããå ¨çæãè¿ããã ããæ代ã«ãã£ã¦ã¯å¿ é ã¨ãè¨ãããã®ã§ãã blog.livedoor.jp ãã©ã¦ã¶ä¸ã§åæ¹åéä¿¡ãè¡ãããã®è¦æ ¼ã¨ãã¦ã¯ãããã¾ã§ã«ã Ajax ã Comet ã¨ãã£ããã®ãããã¾ãããã ãµã¼ãããã®ããã·ã¥éä¿¡ãã§ããªããã¨ãè² è·ãé«ãã¨ãã£ãåé¡ãããã ããããç°¡æ½ãªå®è£ ã§è§£æ¶ã§ããæè¡ãæ±ãããã¦ããããã§ãã â»Ajax, Comet,
ããã«ã¡ã¯ãTokyo Otaku Mode CTOã®é¢æ ¹ã§ãã Tokyo Otaku Modeã§ã¯ã2013å¹´8æããotakumode.comä¸ã«ã«ã¼ãæ©è½ã追å ãã決æ¸ã¾ã§ãã¯ã³ã¹ãããã§ã§ããæµ·å¤åãECãµã¤ããã¹ã¿ã¼ããã¾ããã ã©ãããã·ã¹ãã æ§æã§otakumode.comãéç¨ããã¦ããããèãããæããNode.js + MongoDBã§ããã¨çããã¨ãã¨ã³ã¸ãã¢ã®çããã¯ä¸æ§ã«ã³ã£ãããã¾ããç¹ã«é©ãããã®ããMongoDBãã¡ã¤ã³ã®DBã«ä½¿ç¨ãã¦ããç¹ã§ããä¿¡é ¼æ§ã«å®è©ãããããã§ãªããã¾ãNoSQLã«å¯¾ããã©ã¤ããªã¤ã¡ã¼ã¸ãä¸è¬çã«ãããããECãµã¤ãã®ãããã¯ã·ã§ã³ã¨ãã¦ä½¿ããã¨ã«çåãæããã¦ããæ¹ãå¤ãã®ã§ãããã ããããååå®ç¨ã«èããæ¥ã æ©è½è¿½å ãå ¥ãæé·ãç¶ããã¹ã¿ã¼ãã¢ããã®ç°å¢ã§ãå®éã«1å¹´ééç¨ãã¦ããECãµã¤ããããã«ãããã¨ãäºå®ã§ãã ã
mongoDBã使ã£ã¦WEBã¢ããªã±ã¼ã·ã§ã³ä½ã£ã¦ã¿ããã¦ã ã§ãDjango1.4ã¯ã¾ã mongoDBã«å¯¾å¿ãã¦ãªãã¨ãããã¨ã§ã å¥ã®ãã¬ã¼ã ã¯ã¼ã¯ãflaskã使ã£ã¦ãã£ã¦ã¿ããã¨ã«ã ããè³æç¡ãããªã¼ã¨æ¢ãã¦ãããã¥ã¼ããªã¢ã«ããã£ãã®ã§ã ããããã£ã¦ã¿ããã¨ã«ã Write a Tumblelog Application with Flask and MongoEngine http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-flask-mongoengine/ ã¡ãªã¿ã«tumblelogã¨ããã®ã¯ ãªã³ã¯ãæç« ã®å¼ç¨ãåçãåç»ãªã©ãæ稿ããã ãã®ã·ã³ãã«ãªããã° tumblelogã¨ã¯ ã ããã§ãã è¦ã¯Tumblrã§ããã æ©è½ã¨ãã¦ã¯ï¼ã¤ã ã¿ããªããã¹ããè¦ãã¦ã³ã¡ã³ã
ãªã©ã¤ãªã¼å¦ç¿ãã©ãããã©ã¼ã ã§ããã¯ãã¼ã ã«ãããªãåã ããã¯ãã¼ã ã®ç¥èã¯ååã§ããããï¼ ãªã©ã¤ãªã¼å¦ç¿ãã©ãããã©ã¼ã ã«ã¢ã¯ã»ã¹ãããã¨ã§ããã®åé¡ã¯è§£æ±ºãã¾ãããªã©ã¤ãªã¼ã¯ãã©ã¼ãã¥ã³100ã®ãã¡60社以ä¸ããä¿¡é ¼ããã¦ãã¾ããããããã¨ãã£ããã«å¦ã³ãæé·ãã¾ããããããã¯ãã¼ã ã®ã¬ãã«ã¢ãããæ¯æ´ãã¾ãã ãã£ã¨è©³ããç¥ã
1ã¶æ以ä¸ã¶ãã®æ´æ°â¦ Pythonã§ä½ãã¢ããªæ¸ããããªã¨æã£ã¦ã¯ããã®ã§ãRSS Readerãä½ãã¾ããã ãã¬ã¼ã ã¯ã¼ã¯ã¯èããã¤ãè¯ãã£ãã®ã§Flaskãããã¼ã¿ã¯MongoDBã«çªã£è¾¼ãã§ãã¾ãã å®ç©ã¯Herokuã«ãããã¤ãã¦ããã¾ãã Cobra 1000ch/cobra Flask + MongoDBã®ã¨ããã¾ã§å®è£ ãã¦æ«ãæ¾ç½®ãã¦ãã¾ããããæè¿æãã¤ãã§Polymerãããè¾¼ãã ã®ã§è¨äºã«ãã¦ã¿ãã ãã£ã¦ãã㨠ã¹ã±ã¸ã¥ã¼ã©ã§opmlã«ç»é²ãã¦ããRSSããè¨äºãåå¾ãMongoDBã«ä¿å ããããã¼ã¸ã§50件ãã¤è¨äºã®è¡¨ç¤º & éåæã§50件ã¥ã¤åå¾ è³¼èªãã¦ããRSSã§è¡¨ç¤ºããè¨äºããã£ã«ã¿ Polymerå ¥ããåã¯ãã¼ããã¦ãããã¼ã¿ããã£ãã表示ãã¦ã¾ããã æ£ç´50件ãã¤åå¾ã«ãããã¨ã§ä½¿ãå¿å°ãè½ã¡ãã使ãããã ãã Opml(XML)ã®ãã¼ã¹âè¨äºã®
MongoDBã«ã¡ãã£ã¨èå³ããã£ãã®ã§MongoDBã¤ã³ã»ã¢ã¯ã·ã§ã³ãè²·ã£ã¦èªãã§ã¾ã ãã®æ¬ã§Twitterãããã¤ã¼ããããã¦åºåããä¾ãããã§ãã ãã®æ¬rubyã§ä¾é¡ãæ¸ããã¦ããã§ã.. ã¾ãããã«ä¾é¡ã¯rubyã§ç¤ºãã¾ããåºæ¬çãªæ©è½ãã使ããªãã®ã§ä»ã®è¨èªã§ãã§ããã§ãããã¨æ¸ãã¦ãããã ãã©Sinatraã¢ã¸ã¥ã¼ã«ããã£ã¨ä½¿ã£ã¦ã¦ãã£!!ã¦ãªã£ã PHPã§ä½ã£ã¦ãé¢ç½ããªããªãã¨æã£ãã®ã§Pythonã®åå¼·ãå ¼ãã¦Pythonã§ãã®ä¾é¡ãæ¸ãã¦ã¿ã¾ãã 使ç¨ãããã® MongoDB 2.4.9 Python2.7.5 pymongo twitter 1.10.2 Juno 0.1.2 jinja2 2.7.2 MongoDBã¯Homebrewã§, ã¢ã¸ã¥ã¼ã«ã¯pipã§ã¤ã³ã¹ãã¼ã«ãã¾ããã ãã¡ã¤ã«æ§æ . âââ config.py âââ templates â Â
å¾æ¥ã¯ãããã¤ã³ã¿ã¼ãããã®ã¬ã³ã¿ã«ãµã¼ãã¼ã®ã¹ã¿ã³ãã¼ããã©ã³ããå¥ç´ãã¦ãªãã¦ãcgiããåãããªãã®ã§ã¡ãã£ã¨å¤§å¤ã ã£ããããã§æãåã£ã¦VPSãå¥ç´ãã¦åããã¦ã¿ããã¨ããããã¡ã¢ã ãããã®VPSãå¥ç´ CPUä»®æ³2ã³ã¢ ã¡ã¢ãª1GB HDD100GB æé¡980å(å¹´é¡10,780å) ã¨ãããã©ã³(ä¸çªå®ããã¤)ã«ããã å¥ç´å¾ããããå¾ ã¤ã¨ãã¡ã¼ã«ã§rootã®åæãã¹ã¯ã¼ããéããã¦ããã ã³ã³ããã¼ã«ããã«ã«å ¥ãããã·ã³ãèµ·åãããã ã¦ã¼ã¶ã¼ã¾ãã Macã®ã¿ã¼ããã«ããã $ ssh root@(ãµã¼ãã¼ã®IP) Password: (åæãã¹ã¯ã¼ã)ããã§ã¤ãªãã£ãã ã¾ãã¯rootã®ãã¹ã¯ã¼ããèªåã§èãããã®ã«å¤æ´ããããã«ä¸è¬ã¦ã¼ã¶ã¼ãnacookanããä½ããããã«ããã¹ã¯ã¼ããè¨å®ããã ããã¦æ¨©éãä¸ããã # passwd (rootã®æ°ãããã¹ã¯ã¼ã
ã¿ã¤ãã«ã®ã¨ããã§ãããã±ã¼ã¹ã¨ãã¦ã¯Flaskã¿ãããªè»½ããã¬ã¼ã ã¯ã¼ã¯ã§MongoDBããã¼ã¿ãã¼ã¹ã«ä½¿ãModelãèªåã§å®è£ ãããããªå ´åã§ãã å®éã«ãã¼ã¿ãã¼ã¹ãåããModelã®ãã¹ããæ¸ãã¨ãã«ãFlaskã¯ãã«ã¹ã¿ãã¯ã®Djangoã¨éã£ã¦ä½ãé¢åãè¦ã¦ãããªãã®ã§ãèªåã§ãã¹ãã®ã¨ãã ã使ç¨ããdbã®ä½æãç ´æ£ãªã©ãè¡ãå¿ è¦ãããã¾ãã ãããããã¨ã¯ã ãã¹ãèµ·åæã«ãã¹ãç¨ã®db('test')ãä½æ ãã¹ãç¨ã®ãã¼ã¿(json)ãäºãdbã«å ¥ãã¦ãã Modelã¯ã©ã¹ã®ã¡ã½ããããã¹ã ãã¹ãçµäºæã«ãã¹ãç¨ã®dbã®ç ´æ£ ã¨ããæµãã§ããmongodã®èµ·åã¨çµäºã¾ã§é¢åãè¦ã¦ãããã¨ãã£ã¨ä¾¿å©ãªã¯ãã§ãããä»åã¯ããã¾ã§æ±ããªãã£ãã®ã§ãmongodã¯äºåã«èµ·åãã¦ããã¨ããåæã«ãªãã¾ãã *1 ã³ã¼ãã«ããã¨ãããªæãã§ããPython2.7ã§åä½ç¢ºèªãã¦ãã¾
mongoã³ãã³ãããæ¥ç¶ããéã«ãªã¼ã«ãã¿ã¤ã(SQLè³)ããæã 人é¡ã«ã 調ã¹ãããå½¢ã§insertãselectãupdateãè¡ãæ¹æ³ã調ã¹ã¾ããã å®ç¾©åç § // use [ãã¼ã¿ãã¼ã¹å] use [ãã¼ã¿ãã¼ã¹å] // show databases show dbs // show tables show collectionsåç §ç³» // select * from [ã³ã¬ã¯ã·ã§ã³å] db.[ã³ã¬ã¯ã·ã§ã³å].find() // select * from [ã³ã¬ã¯ã·ã§ã³å] where x=4 db.[ã³ã¬ã¯ã·ã§ã³å].find({x:4}) // select j from [ã³ã¬ã¯ã·ã§ã³å] where x=4 db.[ã³ã¬ã¯ã·ã§ã³å].find({x:4}, {j:1}) // select * from [ã³ã¬ã¯ã·ã§ã³å] limit 1 db.[ã³ã¬ã¯ã·ã§ã³
ä¹ ã ã®ã©ãã§ããã話ã å¥ã«KVSãªãã¦ä»ã«å§ã¾ã£ã話ã§ããªããã ãã©ãã¡ã¨ä»äºã§ä½¿ããããããªãã®ã§è©¦ãã¦ã¿ãã MongoDBã£ã¦ä½ãï¼ ä»¥ä¸ã®ç¹å¾´ããã¤æè¬NoSQLãã¼ã¿ãã¼ã¹ã®1ã¤ã(ç¹å¾´ã®æ¥æ¬èªè¨³ã¯ãã®ã¸ã) ããã¥ã¡ã³ãæåã®ã¹ãã¬ã¼ã¸ ãã«ã¤ã³ããã¯ã¹ããµãã¼ã ã¬ããªã±ã¼ã·ã§ã³ã¨é«ãå¯ç¨æ§ èªåã·ã§ã¢ã¼ãã£ã° é«æ©è½ãªããã¥ã¡ã³ããã¼ã¹ã¯ã¨ãª Fast In-Placeãªæ´æ° Map/Reduce GridFSã«ãããã¡ã¤ã«ä¿å åç¨ãµãã¼ãããã MongoDBã®å ¥æ MongoDBã¯ãã®è¾ºãããã¦ã³ãã¼ã Macç¨ãWindowsç¨ããã®ä»ã®OSç¨ããã«ããããã¢ã¸ã¥ã¼ã«ãç¨æããã¦ããã 試é¨ç°å¢ã¯Windows XP SP3(32bit)ãªã®ã§ãããã«è©²å½ãããã®ããã¦ã³ãã¼ã MongoDBã®ã¤ã³ã¹ãã¼ã« ãã¦ã³ãã¼ããããã¡ã¤ã«ã¯åãªãzipãã¡ã¤ã«ãªã®ã§ã解
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}