[Mongoose] TypeError: Cannot read property ‘options’ of undefined
- 2014 10/30
Mongoose でスキーマ定義に type: ObjectId としている field にオブジェクト型のデータが入ってると TypeError: Cannot read property ‘options’ of undefined エラーが発生します。
Mongoose でスキーマ定義に type: ObjectId としている field にオブジェクト型のデータが入ってると TypeError: Cannot read property ‘options’ of undefined エラーが発生します。
rvm で Ruby version 2.1.3 をインストールすると Empty path passed to certificates update 的なエラーが発生しました。
% rvm install 2.1.3 Searching for binary rubies, this might take some time. Found remote file https://rubies.travis-ci.org/osx/10.9/x86_64/ruby-2.1.3.tar.bz2 Checking requirements for osx_brew. Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. Requirements installation successful. ruby-2.1.3 - #configure ruby-2.1.3 - #download ruby-2.1.3 - #validate archive ruby-2.1.3 - #extract ruby-2.1.3 - #validate binary ruby-2.1.3 - #setup ruby-2.1.3 - #gemset created /Users/bakorer/.rvm/gems/[email protected] ruby-2.1.3 - #importing gemset /Users/bakorer/.rvm/gemsets/global.gems...................................................................... ruby-2.1.3 - #generating global wrappers.............. ruby-2.1.3 - #gemset created /Users/bakorer/.rvm/gems/ruby-2.1.3 ruby-2.1.3 - #importing gemsetfile /Users/bakorer/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.1.3 - #generating default wrappers.............. /Users/bakorer/.rvm/scripts/functions/support: line 490: 56810 Trace/BPT trap: 5 "$ruby_path" -rrbconfig -e '\ File.open("'"$config_path"'","w") { |file| RbConfig::CONFIG.sort.each{|key,value| file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.gsub("$","\\$")}\"\n") } } ' > /dev/null 2>&1 Empty path passed to certificates update, functions stack: requirements_osx_update_openssl_cert_run rvm_requiremnts_fail_or_run_action __rvm_osx_ssl_certs_ensure_for_ruby __rvm_osx_ssl_certs_ensure_for_ruby_except_jruby external_import_setup external_import main |
Ruby 2.1.3 を使おうとすると dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib という libgmp が読み込めないというメッセージが表示されてしまいます。
% rvm use 2.1.3 Using /Users/bakorer/.rvm/gems/ruby-2.1.3 dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib Referenced from: /Users/bakorer/.rvm/rubies/ruby-2.1.3/bin/ruby Reason: Incompatible library version: ruby requires version 13.0.0 or later, but libgmp.10.dylib provides version 12.0.0 |
下記のように disable-binary フラグを付けて再インストールをすると直るようです。
% rvm reinstall 2.1.3 --disable-binary ruby-2.1.3 - #removing rubies/ruby-2.1.3 - please wait Checking requirements for osx_brew. Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/bakorer/.rvm/rubies/ruby-2.1.3, this may take a while depending on your cpu(s)... ruby-2.1.3 - #downloading ruby-2.1.3, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.4M 100 11.4M 0 0 5118k 0 0:00:02 0:00:02 --:--:-- 5118k ruby-2.1.3 - #extracting ruby-2.1.3 to /Users/bakorer/.rvm/src/ruby-2.1.3 - please wait ruby-2.1.3 - #configuring - please wait ruby-2.1.3 - #post-configuration - please wait ruby-2.1.3 - #compiling - please wait ruby-2.1.3 - #installing - please wait ruby-2.1.3 - #making binaries executable - please wait Rubygems 2.2.2 already available in installed ruby, skipping installation, use --force to reinstall. ruby-2.1.3 - #gemset created /Users/bakorer/.rvm/gems/[email protected] ruby-2.1.3 - #importing gemset /Users/bakorer/.rvm/gemsets/global.gems - please wait ruby-2.1.3 - #generating global wrappers - please wait ruby-2.1.3 - #gemset created /Users/bakorer/.rvm/gems/ruby-2.1.3 ruby-2.1.3 - #importing gemsetfile /Users/bakorer/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.1.3 - #generating default wrappers - please wait ruby-2.1.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.1.3 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri Making gemset ruby-2.1.3 pristine - please wait Making gemset ruby-2.1.3@global pristine - please wait |
以上です。
・osx – Error when installing Ruby 2.1.3 with RVM – Stack Overflow
Redis で、特定の文字列を含む key の値を全て取得するコマンドをメモ
redis-cli KEYS "prefix*" | xargs redis-cli MGET |
JavaScript で merge recursive なメソッドは lodash.merge を使うのが良さそう。
・_.merge – Lo-Dash documentation
説明とかはここには書かないので、参考情報を読むといいですよ。
Express (Node.js) + Mongoose (MongoDB) なアプリケーションで下記のような MongoError: Runner error: Overflow sort stage buffered data usage of 33555427 bytes exceeds internal limit of 33554432 bytes エラーが発生しました。