Skip to content

myoneray/Mongodb-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

mongodbDemo

mongodb 数据如下:

mongo 127.0.0.1:27017     
MongoDB shell version: 2.4.9
connecting to: 127.0.0.1:27017/test
> show dbs
anu	0.203125GB
local	0.078125GB
> use anu
switched to db anu
> show 
Mon Aug 24 14:40:09.140 don't know how to show [] at src/mongo/shell/utils.js:847
> show collections
system.indexes
totalInterfaceAccessAmount_3secs
> db.totalInterfaceAccessAmount_3secs.find();
{ "_id" : ObjectId("55da86cc04a6a8dcadea6120"), "ts" : NumberLong("1440384716460"), "value" : NumberLong(6) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6121"), "ts" : NumberLong("1440384716468"), "value" : NumberLong(9) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6122"), "ts" : NumberLong("1440384716469"), "value" : NumberLong(4) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6123"), "ts" : NumberLong("1440384716469"), "value" : NumberLong(3) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6124"), "ts" : NumberLong("1440384716470"), "value" : NumberLong(3) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6125"), "ts" : NumberLong("1440384716470"), "value" : NumberLong(3) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6126"), "ts" : NumberLong("1440384716471"), "value" : NumberLong(6) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6127"), "ts" : NumberLong("1440384716471"), "value" : NumberLong(3) }
{ "_id" : ObjectId("55da86cc04a6a8dcadea6128"), "ts" : NumberLong("1440384716472"), "value" : NumberLong(0) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ece"), "ts" : NumberLong("1440399199083"), "value" : NumberLong(5) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ecf"), "ts" : NumberLong("1440399199083"), "value" : NumberLong(9) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ed0"), "ts" : NumberLong("1440399199084"), "value" : NumberLong(3) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ed1"), "ts" : NumberLong("1440399199084"), "value" : NumberLong(8) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ed2"), "ts" : NumberLong("1440399199085"), "value" : NumberLong(8) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ed3"), "ts" : NumberLong("1440399199085"), "value" : NumberLong(0) }
{ "_id" : ObjectId("55dabf5f04a6e6acfc3a3ed4"), "ts" : NumberLong("1440399199085"), "value" : NumberLong(4) }

Type "it" for more

> use anu
switched to db anu
> db.dropDatabase()
{ "dropped" : "anu", "ok" : 1 }
> db.totalInterfaceAccessAmount_3secs.count()

注意:applicationContext.xml

  <bean id="personRepository" class="com.mongo.dao.impl.PersonRepository">
		<property name="mongoTemplate" ref="mongoTemplate"></property>
	</bean>

com.mongo.dao.impl.PersonRepository路径!

其他配置信息完成即可!

版本较低。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages