mongodb - Mongo $text search not working on nested object? -


this code

var mongoose = require('mongoose'); var schema = mongoose.schema;  mongoose.connect('mongodb://localhost/mongo_search_problem');  var test = new schema({   text: { type: string, required: true },   level: {     two: { type: string, required: true }   } });  test.index({   text: 'text',   'level.two': 'text' });  var model = mongoose.model('tests', test);  model.find({ $text: { $search: 'two' } }, function(err, result){   console.log(result); }); 

this document

{   "text" : "text",   "level" : {     "two" : "two"   } } 

it return nothing if search two, if search text instead return document.

why won't work on nested object?


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -