Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Why doesn't my MongoDB $or query work?

Simply because $or should be a top level operator in your query, like this:

db.collection.find({
        "$or": [
            {
                "metadata.text": { "$regex": ".*hello.*" }
            },
            {
                "metadata.text": { "$regex": ".*world.*" }
            }
        ]
})

Tags:

Mongodb

Related

What is the usage of tag over the cell in jupyter? pip3: command not found "Named colors do not work prior to iOS 11.0" error referring to a storyboard Where VS Code stores the list of open files? How to maximise Screen use in Pupeteer ( non-headless ) Laravel Impossible to Create Root Directory Searching an int column on the basis of a string value How to sum the values in List<int[]> using Java 8 Why does format("kafka") fail with "Failed to find data source: kafka." (even with uber-jar)? time and geographical subset of netcdf raster stack or raster brick using R Net core generic repository pattern how to inject DbContext without knowing its type at compile time? ionic 3 Close ion-item-sliding

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy