MongoDB - how to search fields with different data types? -


i search multiple fields in document. each of these fields of type date, string or number. have tried using $or query using regex search search term, search within field of type string:

somecollection.find({     $or: [         {sometext:   /searchterm/},         {somedate:   /searchterm/},         {somenumber: /searchterm/}     ] }); 

is posisble search across fields different data types?


Comments

Popular posts from this blog

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - SSE Emitter : Manage timeouts and complete() -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -