Initialization of bean failed; nested exception is org.springframework.beans.factory.: 错误分析
2013-08-20 11:45
639 查看
mongo之查询
1,find命令初步使用。
查询某个集合中的文档,比如查询集合user中的文档命令如下:
db.user.find()
2,查询符文档中某个键值/数值 为特定的文档
db.user.find({"age" : 19})
3,指定返回值
db.user.find({},{"age" : 1})
返回user集合中所有文档的age字段
但是结果中会自动返回_id键值,如下代码可以去除返回信息的_id键值
db.user.find({},{"age" : 1 ,"_id" : 0})
4,查询条件
$lt $lte $gt $gte $ne ,分别对应 > 、>= 、< 、<=、 =
年龄大于1小于42
db.user.find({"age" : {"$gt" : 1, "$lt" : 42}})
5、OR查询
db.user.find({"$or" : [{"name" : "zhlccna"}, {"age" : 1}]})
> db.user.find({"$or" : [{"name" : "zhlccna"}, {"age" : 1}]})
{ "_id" : ObjectId("50900a7fdc60973b77877536"), "name" : "zhlccna", "age" : 42 }
{ "_id" : ObjectId("50900aa5dc60973b77877538"), "name" : "zhlccna2", "age" : 1 }
1,find命令初步使用。
查询某个集合中的文档,比如查询集合user中的文档命令如下:
db.user.find()
> db.user.find() { "_id" : ObjectId("50900a7fdc60973b77877536"), "name" : "zhlccna", "age" : 42 } { "_id" : ObjectId("50900a94dc60973b77877537"), "name" : "zhlccna1", "age" : 19 } { "_id" : ObjectId("50900aa5dc60973b77877538"), "name" : "zhlccna2", "age" : 1 } { "_id" : ObjectId("509010d7eb5b2c744c6b9247"), "name" : 20, "age" : "zhlccna" }
2,查询符文档中某个键值/数值 为特定的文档
db.user.find({"age" : 19})
> db.user.find({"age" : 19}) d" : ObjectId("50900a94dc60973b77877537"), "name" : "zhlccna1", "age" : 19 }
3,指定返回值
db.user.find({},{"age" : 1})
> db.user.find({},{"age" : 1}) { "_id" : ObjectId("50900a7fdc60973b77877536"), "age" : 42 } { "_id" : ObjectId("50900a94dc60973b77877537"), "age" : 19 } { "_id" : ObjectId("50900aa5dc60973b77877538"), "age" : 1 } { "_id" : ObjectId("509010d7eb5b2c744c6b9247"), "age" : "zhlccna" }
返回user集合中所有文档的age字段
但是结果中会自动返回_id键值,如下代码可以去除返回信息的_id键值
db.user.find({},{"age" : 1 ,"_id" : 0})
> db.user.find({},{"age" : 1 ,"_id" : 0}) { "age" : 42 } { "age" : 19 } { "age" : 1 } { "age" : "zhlccna" }
4,查询条件
$lt $lte $gt $gte $ne ,分别对应 > 、>= 、< 、<=、 =
年龄大于1小于42
db.user.find({"age" : {"$gt" : 1, "$lt" : 42}})
> db.user.find({"age" : {"$gt" : 1, "$lt" : 42}}) { "_id" : ObjectId("50900a94dc60973b77877537"), "name" : "zhlccna1", "age" : 19 }
5、OR查询
db.user.find({"$or" : [{"name" : "zhlccna"}, {"age" : 1}]})
> db.user.find({"$or" : [{"name" : "zhlccna"}, {"age" : 1}]})
{ "_id" : ObjectId("50900a7fdc60973b77877536"), "name" : "zhlccna", "age" : 42 }
{ "_id" : ObjectId("50900aa5dc60973b77877538"), "name" : "zhlccna2", "age" : 1 }
相关文章推荐
- Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigExcep
- Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException
- Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.Be
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
- 严重:Context initialization failed org.springframework.beans.factory.BeanCreationException: 解决方案
- nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Can
- nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException
- 严重: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error cre
- Context initialization failed org.springframework.beans.factory.BeanCreationException:
- Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creatin
- 报错解决Context initialization failed org.springframework.beans.factory.BeanCreationException
- 在使用hibernate 和spring 构架的框架中如果出现Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm
- HTTP Status 500 - Request processing failed; nested exception is org.springframework.beans.BeanInsta
- org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jboss.resteasy.plug
- Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'dao' is exp
- shiro错误 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type
- Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm