Last active
August 29, 2015 14:11
-
-
Save bgvo/bb9ac76968cad1c4eddd to your computer and use it in GitHub Desktop.
Search not working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST.JS | |
db.createCollection("test_index") | |
db.test_index.ensureIndex({"t.n":"text"}) | |
var mydocs = [ | |
{t: [{language: "english", n: "Mother 1"},{language: "spanish", n: "Madre 1"}]}, | |
{t: [{language: "english", n: "Spreme 1"},{language: "spanish", n: "Edificio 1"}]} | |
] | |
db.test_index.insert(mydocs) | |
FROM CONSOLE | |
mongo localhost/test_index test.js | |
mongo test_index --eval 'printjson(db.test_index.findOne({$text: {$search: "Edificio"}}))' | |
RESULT | |
Borjas-MacBook-Pro:Development borjagvo$ mongo test_index --eval 'printjson(db.test_index.findOne({$text: {$search: "Edificio"}}))' | |
MongoDB shell version: 2.6.3 | |
connecting to: test_index | |
null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment