# ã¢ã¸ã¥ã¼ã«ãããã mongoose = require 'mongoose' Schema = mongoose.Schema ObjectId = mongoose.Schema.ObjectId ### ã·ã¼ã±ã³ã¹ ### SequenceSchema = new Schema name: { type: String } seq: { type: Number } SequenceSchema.index { name: 1 } Sequence = db.model('Sequence', SequenceSchema) ### ã¦ã¼ã¶ã¹ãã¼ã ### UserSchema = new Schema id: { type: Number, unique: true } name: { type: String } # Middleware ããããã¤ã³ãï¼ UserSchem
Queryæãã¦è¿ã£ã¦ããDocumentsãé¢æ°ãæã£ã¦ãã¦æ¬²ããæã«Virtual Attributes使ãã ã¹ãã¼ã.virtual(âååâ).get(function(){ /**/ }) ã¹ãã¼ã.virtual(âååâ).set(function(){ /**/ }) ã§getter/setterãä»ãããã ä¾ãã°ãMongoDBã«ã¯idããä¿åããªãããã«ãã¦ãpermalinkã®URLçã¯idããçµã¿ç«ã¦ãå ´åãããããé¢æ°ã¯modelã«æããããã å®è£ ä¾ RecipeSchema.virtual(âurlâ).get ã«é¢æ°ãç»é²ãã¦ããã¨ã doc.url ã§å¼ã³åºããã mongoose_virtual_attr.js var _ = require('underscore'); var mongoose = require('mongoose'); mon
mongo, nodejs æmizchiã§ãã 次ã¯ãã¼ã¿ãã¼ã¹ãæ±ãã¾ãã nodejsã¨npmãæ±ãç°å¢ãæ´ã£ãã§ããããã ã¾ã ã®æ¹ã¯ã2011å¹´æéã®ã¦ã§ãã¢ããªéçºç°å¢ã¯node.js/CoffeeScript/Expressã ï¼ã http://d.hatena.ne.jp/eureka_tech/20110629/1309375362 ãåèã«ç°å¢ãä½ã£ã¦ãã ããã MongoDBã¨ã¯ï¼ -> BSONã¨ããç°¡åãªãã¼ã¿æ§é ã§ãã¼ã¿ãã¼ã¹ãæ§ç¯ã§ãã¾ã ãªãã§SQL使ããªãã®ï¼ -> ãããå¦ç¿ã³ã¹ãé«ããï¼ã MySQLã¨MongoDBã®ããã©ã¼ãã³ã¹ã¯ä¸é·ä¸ç ã ã£ããç°¡åãªæ¹ããï¼ ã¤ãã§ã«è¨ãã°ãMongoDBã§æ±ãBSONã¯æ¡å¼µãããJSONã§ãJSONã¨ã¯ã¤ã¾ãJavascriptã§æ¸ããããã¼ã¿å½¢å¼ãªããã§ããããã¸ãã®ç¸æ§ãããããã§ã MongoDBã®ã¤ã³
"...don't count on folks to support higher taxes to improve schools." (via @msnbc) http://cot.ag/gvpyNxHappy holidays! The team is celebrating by doing some extra maintenance at the end of our work day. The site will be back up shortly.Check it out. Yahoo may be planning on shutting down Delicious and Upcoming. http://cot.ag/dMdoqG At LearnBoost, we like to consider ourselves hackers. Â We look to
Let's face it, writing MongoDB validation, casting and business logic boilerplate is a drag. That's why we wrote Mongoose. const mongoose = require('mongoose'); mongoose.connect('mongodb://127.0.0.1:27017/test'); const Cat = mongoose.model('Cat', { name: String }); const kitty = new Cat({ name: 'Zildjian' }); kitty.save().then(() => console.log('meow'));Mongoose provides a straight-forward, schema
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}