Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
# mongo
MongoDB shell version: 1.6.4
Fri Mar 16 11:55:46 *** warning: spider monkey build without utf8 support. consider rebuilding with utf8 support
connecting to: test

Mongo Server seems to handle the utf8 characters fine, as well as my php-mongo-client driver.

But when I try to query a record that has a utf8 character from the mongo command line client I get:

> db.Users.find({age:33});
error:non ascii character detected
Fri Mar 16 11:55:43 mongo got signal 11 (Segmentation fault), stack trace: 

Fri Mar 16 11:55:43 0x440b50 0x3664c302d0 0x3f47e7b6e0 0x3f47e83bbd 0x3f47e254f3 0x3f47e25660 0x3f47e256ee 0x3f47e25792 0x3f47e2876e 0x4b031d 0x443b72 0x445476 0x3664c1d994 0x43fd39
 mongo(_Z12quitAbruptlyi+0x3b0) [0x440b50]
 /lib64/libc.so.6 [0x3664c302d0]
 /usr/lib64/libjs.so.1 [0x3f47e7b6e0]
 /usr/lib64/libjs.so.1(js_CompileTokenStream+0x3d) [0x3f47e83bbd]
 /usr/lib64/libjs.so.1 [0x3f47e254f3]
 /usr/lib64/libjs.so.1(JS_CompileUCScriptForPrincipals+0x60) [0x3f47e25660]
 /usr/lib64/libjs.so.1(JS_EvaluateUCScriptForPrincipals+0x3e) [0x3f47e256ee]
 /usr/lib64/libjs.so.1(JS_EvaluateUCScript+0x22) [0x3f47e25792]
 /usr/lib64/libjs.so.1(JS_EvaluateScript+0x6e) [0x3f47e2876e]
 mongo(_ZN5mongo7SMScope4execERKSsS2_bbbi+0xed) [0x4b031d]
 mongo(_Z5_mainiPPc+0x14a2) [0x443b72]
 mongo(main+0x26) [0x445476]
 /lib64/libc.so.6(__libc_start_main+0xf4) [0x3664c1d994]
 mongo(__gxx_personality_v0+0x269) [0x43fd39]

Any ideas or suggestions would be welcome

share|improve this question

3 Answers 3

up vote 3 down vote accepted

The mongo version 1.6.4 was installed by the package management system, which includes the mongo init scripts.

The solution I came up with was to download the newest Mongo(2.0.3) binaries from http://www.mongodb.org/downloads. Then I replaced all the binaries from the rpm /usr/bin with the ones I downloaded.

Everything now works perfectly!

share|improve this answer
    
Michael - if you want a package management solution with the latest version, 10gen (the creators of MongoDB) have their own repos: mongodb.org/display/DOCS/Ubuntu+and+Debian+packages or mongodb.org/display/DOCS/CentOS+and+Fedora+Packages –  Adam C Mar 22 '12 at 11:14

Just had the same issue. MongoDB shell version: 1.8.2 on Ubuntu (EC2)

> db.tweets.find();

error:non ascii character detected

Checked which version of MongoDB I was running by issuing the command:

$ mongod --version

db version v1.8.2, pdfile version 4.5 - Wed Oct 24 15:43:13 git version: nogitversion

Confirm if mongo is currently running:

$ ps -deaf | grep mongod

mongodb 15408 1 0 Jun06 ? 13:50:00 /usr/bin/mongod --config /etc/mongodb.conf

To Shutdown MongoDB

$ ./mongo

> use admin

> db.shutdownServer()

server should be down...

Then upgraded following these instructions: How to Install MongoDB on Ubuntu

Add the 10 Gen (creators of MongoDB) public key to apt-get so you trust their package:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

$ echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list.d/10gen.list

Update your packages:

$ sudo apt-get update

install 10gen's MongoDB Debian/Ubuntu package:

$ sudo apt-get install mongodb-10gen

The following packages will be REMOVED: mongodb

The following NEW packages will be installed: mongodb-10gen

If you get an error, try:

$ apt-get autoremove

once you have the new version of MongoDB the "non ascii" character issue should be gone.

(p.s. I know this question relates to RHEL but people running other versions of Linux will come up against this issue so I thought a Ubuntu/Debian answer was relevant. Feel free to remove

share|improve this answer

Take a look at:

http://www.mongodb.org/display/DOCS/Building+Spider+Monkey#BuildingSpiderMonkey-Build

"SpiderMonkey does not use UTF-8 by default, so we enable before building."

So, you'll need to rebuild SpiderMonkey.

share|improve this answer
    
I had previously looked into this. However, being that I was on a production server I wanted minimal impact. –  Michael Irey Mar 19 '12 at 18:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.