??一、插入\创建文档--当插入一个不存在的文档时,会自动创建一个文档[root@racdb ~]# mongoMongoDB shell version: 2.4.14connecting to: test> show collections> db.cols.insert({bar:"baz"})> db.cols.find(){ "_id" :ObjectId("56aac1df4e61b6...
分类:
数据库 时间:
2016-01-30 02:54:59
阅读次数:
321
in 只需满足( )内的某一个值即可, 而$all 必须满足[ ]内的所有值,> db.table1.find({});{ "_id" : ObjectId("56a5ce00dd3b78b7f50a298d"), "name" : [ 1, 2, 34, 54, 5, 6, 5 ], "age" ...
分类:
其他好文 时间:
2016-01-25 16:43:07
阅读次数:
130
db.transactions.find({"_id":{"$gt":ObjectId("16a4f6b7d1adb1796ce2e091")},"userId": {$regex:'89A105e1',$options: 'i'}}) * ^ $ db.transactions.find({"_i...
分类:
其他好文 时间:
2016-01-25 06:37:19
阅读次数:
179
MongoDB中存储的文档必须有一个"_id"键。这个键的值可以是任何类型的,默认是个ObjectId对象。ObjectId 是一个12字节 BSON 类型数据,有以下格式:前4个字节表示时间戳接下来的3个字节是机器标识码紧接的两个字节由进程id组成(PID)最后三个字节是随机数。在一个集合里面,每...
分类:
数据库 时间:
2016-01-14 20:49:39
阅读次数:
340
> db.user.find().pretty(){ "_id" : ObjectId("56946fba3a18f4867aecbcd1"), "name" : "admin", "password" : "123456", "title" ...
分类:
其他好文 时间:
2016-01-12 19:31:21
阅读次数:
213
注意:要增加mongodb对应的jar包package cn.toto.mongodb;import java.net.UnknownHostException;import org.bson.types.ObjectId;import org.junit.Test;import com.mongo...
分类:
数据库 时间:
2015-12-31 22:43:11
阅读次数:
184
for (var i = 1; i <= 30; i++) { db.wechatAttention.save({_class:"la.xiaoxiao.manager.wechat.entity.WechatAttentionEntity",ghId:"gh_"+ObjectId().valu.....
分类:
其他好文 时间:
2015-12-19 19:11:54
阅读次数:
165
----创建存储过程create or replace procedure inserttest as cursor cs is select id, name, cla, addr, phone, tel, x, y, shape, objectid from hotel_bak...
分类:
数据库 时间:
2015-11-20 12:34:51
阅读次数:
150
根据ObjectId可得出时间时间区域["2014-01-0100:00:00","2015-11-1500:00:00")在mongoshell,根据时间生成这个区域的idbegin=newDate("2014-01-0100:00:00").getTime()/1000begin=begin.toString(16)begin=begin+newArray(17).join("0")得出52c2ea000000000000000000end=newDat..
分类:
数据库 时间:
2015-11-16 17:46:00
阅读次数:
254
I have a MongoDB collection with documents in the following format:{ "_id" : ObjectId("4e8ae86d08101908e1000001"), "name" : ["Name"], "zipcode" : [...
分类:
其他好文 时间:
2015-11-12 11:45:55
阅读次数:
227