如何在String条件下使用Nodejs mongoose findOne?

时间:2016-03-26 21:12:36

标签: node.js mongoose

我需要这样做,但似乎我做错了,谢谢你的帮助。

#header {
  background-color:#7b88d2;
  text-align:center;
  height: 20px;
}
#container {
  max-width:800px;
  border-style: solid;
  border-width: 1px;
}
#main {
  width: 100%;
  height: 100%;
}
#photo  {
  float:left;
  background-color:#FF3366;
  padding: 10px;
}
#logo  {
  float:right;
  background-color:#FF3366;
  padding-right: 10px;
  height: 100%;
}
#footer {
  background-color:#669933;
  text-align:center;
  height: 20px;
}
#col1 {
  float: left;
  padding-left: 10px;
}
#col2 {
  margin-left:auto;
  margin: 0 auto;
}
#txt_container {
  padding-left: 10px;
  background-color:#ffffcc;
}
#col3 {
  display: inline;
  float: right;
  padding-right: 10px;
}

1 个答案:

答案 0 :(得分:0)

//updated due to comment below

var query_obj = {}
query_obj[var1] = var2

mySchema.findOne(query_obj).exec(function(err,data){
  console.log("this will be your query results: ", data )
})