MongoDB
查询 db.getCollection("deepwaters").find({or:[{"success" : null},{"success" : false}]}).limit(1000).skip(0) db.getCollection('crypto').find({'success':true},{}).sort({'number':1}) db.getCollection('crypto').find({'success':null,'sign_up_crypto':true},{}).sort({'number':1}) db.getCollection('crypto').find({or:[{"success" : null},{"success" : false}],'sign_up_crypto':true},{}).sort({'number':1}) db.createCollection("deepwaters") 插入 db.runCommand( { insert: "deepwaters_30", documents: [ {number:16,first_name:'Doris',last_name:'Kenneth'}, {number:17,first_name:'Great',last_name:'Simona'} ] } 修改 db.getCollection('maverick_form').updateOne({'number':406},{'set':{'success':false,'form':true}}) db.getCollection('maverick_form').update({number:{in:[406,407]}},{'$set':{'success':false,'form':true}}) X
pymongo self.collection.insert_one({'number':self.number,'datetime':time.strftime("%Y-%m-%d %H:%M:%S")})
db.getCollection("ads_env").find({'twitter_email': {"$ne": ''}}, { 'number': 1, 'twitter_email': 1, 'data_datetime': 1 }).sort({'number': 1})
删除某个字段 db.ancient8.updateOne( { number: 405 }, { $unset: { success: ""} } )
//通过cursor执行. navicat在打印输出中查看 var myCursor = db.getCollection('ads_env').find(); while(true){ var myDocument = myCursor.hasNext() ? myCursor.next() : null; if (myDocument) { var myName = myDocument.twitter_handle[0].value; print (tojson(myName)); } else{break} }