# db.command.eq

Query filter, indicating that the value of a field is equal to the specified value. The eq command supports one literal, and may be number, boolean, string, object, array, or Date.

Method signature:

function eq(value: any): Command

For example, to filter out all of the articles published by yourself, you can import objects:

const myOpenID = 'xxx'
db.collection('articles').where({
  _openid: myOpenID
})

Or use the command:

const _ = db.command
const myOpenID = 'xxx'
db.collection('articles').where({
  _openid: _.eq(openid)
})

Note: The eq command is more flexible than object importing, and may indicate that the value of a field is equal to the specified object. For example:

// This indicates that conditions stat.publishYear == 2018 and stat.language == 'zh-CN' are matched.
db.collection('articles').where({
  stat: {
    publishYear: 2018,
    language: 'zh-CN'
  }
})
// This indicates that the stat object is equal to { publishYear: 2018, language: 'zh-CN' }.
const _ = db.command
db.collection('articles').where({
  stat: _.eq({
    publishYear: 2018,
    language: 'zh-CN'
  })
})