Mongoid: object-document-mapper(ODM)

Mongoid Configuration:

rails g mongoid:config

Document:

Documents are the core objects in Mongoid ---- Mongoid::Document

Doucuments can be stored in a collection or embedded in other documents

Fields are attributes -- type String by default

class Movie
include Mongoid::Document
field :title, type: String
end

Field Aliases:

field :birthName, as: :birth_name, type: String 

store_in:

class Location
include Mongoid::Document
store_in collection: "Places"
field :city, type: String
end # Location gets stored in to "places" collection

Intro to Mongoid的更多相关文章

  1. Intro to CSS 3D transforms

    原文地址:Intro to CSS 3D transforms,本文只是翻译了其中的一部分,省去了作者写文章的原因浏览器兼容部分(已经过时) Perspective 元素需要设置需要设置perspec ...

  2. Intro.js 网站演示

    Intro.js 为您的网站和项目提供一步一步的.更好的介绍 使用简单 引入 js 和 css,然后在代码中加入步骤和介绍. 快速小巧 7 KB 的 JavaScript 和 3 KB CSS,就是全 ...

  3. intro.js 页面引导简单用法

    下载地址:http://pan.baidu.com/share/link?shareid=1894002026&uk=1829018343 <!DOCTYPE HTML PUBLIC & ...

  4. 网站引导页插件intro.js 的用法

    intro.js是一个用于制作网页引导效果的js插件,用法很简单,intro.js.v2.0.rar 1.在需要的页面添加引用 intro.js introjs.css 这两个文件已经足够,但是文件夹 ...

  5. Linker scripts之Intro

    1 Intro Every link is controlled by a linker script. The main purpose of the linker script is to des ...

  6. Ruby on Raisl应用(一):在Rails上配置Mongoid+Mongodb

    一. 概述 最近考虑用ruby on rails 搭建一套Blog系统,前端考虑用Bootstrap,数据库用Mongodb.由于之前没有相关应用经验.先记录下整个项目过程. 现有资源: Mac 笔记 ...

  7. Zend-MVC intro

    Zend-MVC intro Zend MVC层建立在servicemanager.eventmanager.http.stdlib.几个组件之上.相关组件介绍会在其他文章中详细说明. 除了以上4大组 ...

  8. rails + mongoid 使用

    1. 测试环境 2. 创建工程 rails new mongoid_app --skip-active-record --skip-test-unit --skip-bundle 3. 修改gemfi ...

  9. Intro to Computer Science Class Online (CS101) - Udacity

    Intro to Computer Science Class Online (CS101) - Udacity Building a Search Engine

随机推荐

  1. Mysql 中如何创建触发器

    use websitelogdb; #创建表 CREATE TABLE `test` ( `idtest` int(11) NOT NULL AUTO_INCREMENT, `testcol` var ...

  2. Python装饰器用法

    在Python中,装饰器一般用来修饰函数,实现公共功能,达到代码复用的目的.在函数定义前加上@xxxx,然后函数就注入了某些行为,很神奇!然而,这只是语法糖而已. 场景 假设,有一些工作函数,用来对数 ...

  3. 【转】pymongo实现模糊查询

    pymongo 模糊匹配查询在mongo中这样实现 {'asr':/若琪/} 使用pymongo 两种实现方式 1.import re {'asr':re.compile('若琪')} 2.{'asr ...

  4. 力导向图Demo

    <html> <head> <meta charset="utf-8"> <title>力导向图</title> < ...

  5. go语言关键字图示

    Go语言一共有25个关键字,除了select,上文基本上已经一网打尽了.为了加深印象,我们用一张结构图来说明一下: 这张图如果看不清的话,我们将其拆成两张图,再注掉分支流程那部分的局部图: 分支流程部 ...

  6. [微信小程序] 认识微信小程序及开发环境搭建

    微信公众平台首页 https://mp.weixin.qq.com 微信公众平台测试帐号系统 https://open.weixin.qq.com/connect/qrconnect?appid=wx ...

  7. 关于Cocos2d-x-3.16的开发环境搭建

    一.需要安装的软件 1.VS2013或者VS2015 2.Cocos:cocos2d-x-3.16:http://www.cocos.com/download 3.Python:python-2.7. ...

  8. minicom for Mac 配置

    安装:brew install minicom 配置: 串口是:dev/tty.usbserial minicons -s 配置一下: 流控要关掉,不然输入不了

  9. 【Clojure 基本知识】 ns宏的 指令(关键字) requrie的用法

    指令(:require)用在(ns)之中,下面是实践中总结的几种用法(下文中省略ns宏,只是给出:require的代码): 一.导入完整名称空间. 1,最简单的形式: (:require clojur ...

  10. 解决ubuntu下音乐播放器Rhythmbox乱码问题

    两种解决方法 第一种是修改用户的环境变量 1.先打开主文件夹 cd /home/user #user是你的用户名然后编辑用户环境 2.sudo gedit .profile在打开的文件中添加: exp ...