来源:自学PHP网 时间:2019-08-01 18:22 作者:小飞侠 阅读:次
[导读] mongodb的写操作...
使用插入数据命令: 哦,另外说一句,如果这个bios数据不存在,那么要先使用 db.bios.insert( [ { _id: 3, name: { first: 'Grace', last: 'Hopper' }, title: 'Rear Admiral', birth: new Date('Dec 09, 1906'), death: new Date('Jan 01, 1992'), contribs: [ 'UNIVAC', 'compiler', 'FLOW-MATIC', 'COBOL' ], awards: [ { award: 'Computer Sciences Man of the Year', year: 1969, by: 'Data Processing Management Association' }, { award: 'Distinguished Fellow', year: 1973, by: ' British Computer Society' }, { award: 'W. W. McDowell Award', year: 1976, by: 'IEEE Computer Society' }, { award: 'National Medal of Technology', year: 1991, by: 'United States' } ] }, { _id: 4, name: { first: 'Kristen', last: 'Nygaard' }, birth: new Date('Aug 27, 1926'), death: new Date('Aug 10, 2002'), contribs: [ 'OOP', 'Simula' ], awards: [ { award: 'Rosing Prize', year: 1999, by: 'Norwegian Data Association' }, { award: 'Turing Award', year: 2001, by: 'ACM' }, { award: 'IEEE John von Neumann Medal', year: 2001, by: 'IEEE' } ] }, { _id: 5, name: { first: 'Ole-Johan', last: 'Dahl' }, birth: new Date('Oct 12, 1931'), death: new Date('Jun 29, 2002'), contribs: [ 'OOP', 'Simula' ], awards: [ { award: 'Rosing Prize', year: 1999, by: 'Norwegian Data Association' }, { award: 'Turing Award', year: 2001, by: 'ACM' }, { award: 'IEEE John von Neumann Medal', year: 2001, by: 'IEEE' } ] } ] ); db.bios.insert( { name: { first: 'John', last: 'McCarthy' }, birth: new Date('Sep 04, 1927'), death: new Date('Dec 24, 2011'), contribs: [ 'Lisp', 'Artificial Intelligence', 'ALGOL' ], awards: [ { award: 'Turing Award', year: 1971, by: 'ACM' }, { award: 'Kyoto Prize', year: 1988, by: 'Inamori Foundation' }, { award: 'National Medal of Science', year: 1990, by: 'National Science Foundation' } ] } ) c = db.bios.find( { name: { first: 'John', last: 'McCarthy' } } ); while((c.hasNext())) printjson(c.next()) |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com