search

Home  >  Q&A  >  body text

mongodb find 查询报错

在mongo 命令行下执行如下查询

db.users.find({})

能正常的读取集合中的所有数据,
但是执行如下查询命令,则报错

db.users.find({loginname:'test'})
error: {
    "$err" : "Unable to execute query: error processing query: ns=im.users limit=0 skip=0\nTree: loginname == \"lidian\"\nSort: {}\nProj: {}\n No query solutions",
    "code" : 17007
}

mongodb 配置的副本集(Replica Set)

滿天的星座滿天的星座2762 days ago552

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-04-27 09:04:35

    • There is no problem with the query statement. There should be an error somewhere else. Create a new table and test it

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-04-27 09:04:35

    General query, no problem.

    It’s no problem to check one.

    Sir, you can check if there is a loginname field in your user collection.

    reply
    0
  • Cancelreply