DDCODE

Share programming skills from Magic Oriental

upArrow

MongoDB Query (Difference between Two Fields as Conditional Query)

 May 12, 2019   mongodb, question

field

  • name string
  • x int
  • y int

Table record

name x y
jhon 1 2
lily 2 1
gan 3 2

Query result

Query all name for all x > y

db.collections.find({'$where': "this.x > this.y"}, {'name': 1})

Related Posts:

  • Mysql multi-table query compares the maximum and…
  • What is the difference between http-equiv…
  • The query result is used as a condition for…
  • How does mysql represent the difference between two fields
  • Database: Is there a big difference in the amount of…
  • What is the difference between the two query methods…
  • Xorm One Table, Two Fields, How to Handle Associated…
  • How does mongoDB query conditional on the range of…
  • Is Mongodb getting the whole document after…
<< Why can’t mongo receive responses from other nodes when creating replicaSet? How do I insert data into the specified location of the array using the mongodb command? >>

Related Posts:

  • Mysql multi-table query compares the maximum and…
  • What is the difference between http-equiv…
  • The query result is used as a condition for…
  • How does mysql represent the difference between two fields
  • Database: Is there a big difference in the amount of…
  • What is the difference between the two query methods…
  • Xorm One Table, Two Fields, How to Handle Associated…
  • How does mongoDB query conditional on the range of…
  • Is Mongodb getting the whole document after…

Tags

Android android-studio apache c c++ centos Css css3 Database Docker Eclipse Express Front end git GitHub golang Html html5 Ios java javascript Jquery Laravel linux macos mongodb mysql Nginx node.js npm objective-c php Programmer python redis ruby shell Spring Sql Swift ubuntu vim vue.js Web xcode

Powered by MyWiki WordPress Theme