NoSql???????-mongoDB??????
???????????? ???????[ 2014/7/21 11:56:01 ] ????????NoSql mongoDB ?????
?????????find????????????α????
????????????????????????????α????????????????????20??????????????????????????????????????testData?????????????
????{ "_id" : ObjectId("4c2209f9f3924d31102bd84a")?? "name" : "mongo" }
????{ "_id" : ObjectId("4c2209fef3924d31102bd84b")?? "x" : 3 }
????_id??????mongoDB??????????????????????????“????”?????????????????????????????????????????_id??
??????????????????????????
??????????????????
????for (var i = 1; i <= 25; i++) db.testData.insert( { x : i } )
???????for??????????????25??????
????????????????
????db.testData.find()
??????????
{ "_id" : ObjectId("4c2209f9f3924d31102bd84a")?? "name" : "mongo" } { "_id" : ObjectId("4c2209fef3924d31102bd84b")?? "x" : 3 } { "_id" : ObjectId("51a7dc7b2cacf40b79990be6")?? "x" : 1 } { "_id" : ObjectId("51a7dc7b2cacf40b79990be7")?? "x" : 2 } { "_id" : ObjectId("51a7dc7b2cacf40b79990be8")?? "x" : 3 } { "_id" : ObjectId("51a7dc7b2cacf40b79990be9")?? "x" : 4 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bea")?? "x" : 5 } { "_id" : ObjectId("51a7dc7b2cacf40b79990beb")?? "x" : 6 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bec")?? "x" : 7 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bed")?? "x" : 8 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bee")?? "x" : 9 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bef")?? "x" : 10 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf0")?? "x" : 11 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf1")?? "x" : 12 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf2")?? "x" : 13 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf3")?? "x" : 14 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf4")?? "x" : 15 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf5")?? "x" : 16 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf6")?? "x" : 17 } { "_id" : ObjectId("51a7dc7b2cacf40b79990bf7")?? "x" : 18 } has more |
??????????20??????
???????滹??has more??????滹??????
????????????????????it??????????20??????
??????β?????????????????
???????????????????????????α?:
????var c = db.testData.find()
????c???α????
??????????????for?????????????????
????while ( c.hasNext() ) printjson( c.next() )
????printjson???????????json???????
?????α?????hasNext?????????ж??????????????????next?????????????????????
??????????????????5?????????????????
?????????????????α????????????????????????????5????????????????????????????е???????
?????????????????α????????????????±?????磺
????printjson( c [ 4 ] )
?????????????5?????
????{ "_id" : ObjectId("51a7dc7b2cacf40b79990bea")?? "x" : 5 }
???????????????
????c [ 4 ]?????????и?collection?μ???????????棬?????????α????????cursor.toArray() ??????
??????????????е???????????????У?????????????????в??????????4????????????α??±???????e?
???????????????a??18?????document??????????
???????????????????find???????????????find???????????????
??????????????????????????????磺db.testData.find( { x : 18 } )
?????????{x:18}????????????????????????????x?18???????
?????????????£?
????{ "_id" : ObjectId("51a7dc7b2cacf40b79990bf7")?? "x" : 18 }
????????????find????????????α???????????????????????????????????
???????????????????????????α???????????findOne??????findOne???????????????????????????????????ж???????????????????
????????????????????????????????????α??????limit?????????£?
????db.testData.find().limit(3)
??????????3?????
??????????£?
????{ "_id" : ObjectId("51a7dc7b2cacf40b79990be6")?? "x" : 1 }
????{ "_id" : ObjectId("51a7dc7b2cacf40b79990be7")?? "x" : 2 }
????{ "_id" : ObjectId("51a7dc7b2cacf40b79990be8")?? "x" : 3 }
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11