Home > Database > Mysql Tutorial > Yan Shiba mongodb video data sharing

Yan Shiba mongodb video data sharing

巴扎黑
Release: 2017-08-25 15:26:36
Original
1610 people have browsed it

MongoDB is a database based on distributed file storage. Written in C++ language. Designed to provide scalable, high-performance data storage solutions for WEB applications.

MongoDB is a product between a relational database and a non-relational database. It is the most feature-rich among non-relational databases and is most like a relational database. The data structure it supports is very loose and is a bson format similar to json, so it can store more complex data types. The biggest feature of Mongo is that the query language it supports is very powerful. Its syntax is somewhat similar to an object-oriented query language. It can almost implement most functions similar to single-table queries in relational databases, and it also supports indexing of data.

MongoDB is written in C++ language and is an open source database system based on distributed file storage. Under high load conditions, adding more nodes can ensure server performance. MongoDB aims to provide scalable, high-performance data storage solutions for WEB applications. "Yan Shiba MongoDB Video Tutorial" will teach you how to use this distributed file storage database.

Yan Shiba mongodb video data sharing

Video playback address: http://www.php.cn/course/317.html

1. R ( Query)
(1) Query the documents whose ticket_no is one of 725, 542, 390 or the winner value is true.
db.raffle.find({"$or" : [ {"ticket_no" : {"$in" :[725,542,390]}},{"winner":true}]})

(2) Return users whose id_num is 2,3,4,5,7,8,9,10,12, etc.

db.users.find({"id_name" : {"not" : {"$mod" : [5,1]}}})

( 3) Find the document where fruit has both "apple" and "banana", "$all"

db.food.find({"fruit" : {"$all" : ["apple"," banana"]}})

(4)The second parameter of find is optional and can specify which keys to return. "$slice" returns a subset of an array.

Now there is a document for a blog post that requires the return of the first 10 comments.

db.blog.posts.findOne(criteria, {"comments" : {"$slice":10}})


(5) Partial matching of embedded documents "$elemMatch"

db.blog.find({"comments" : {"$elemMatch":{"author":"joe","score":{"$gte" : 5}}} )


(6)"$where" can execute arbitrary JavaScript as part of the query

db.foo.find({"$where" : " function(){ return this.x +this.y == 10;}"})


(7)Use of limit, skip, sort

db.stock.find({"desc" : "mp3"}).limit(50).skip(50).sort({"price" : -1})

The above is the detailed content of Yan Shiba mongodb video data sharing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template