Skip to content

Instantly share code, notes, and snippets.

@zerin108
zerin108 / DocumentTest.java
Last active January 29, 2016 07:03
Mongo for JavaDevelopers Driver
package mongo;
import org.bson.Document;
public class DocumentTest {
public static void main(String[] args) {
Document document = new Document()
.append("str", "MongoDB, hello!");
String str = document.getString("str");
}
@zerin108
zerin108 / MongoDB University. CRUD
Last active January 27, 2016 06:37
Week 2. Mongo for Java Developers
Mongo shell is interactive javascript interpretor. Mongo shell can return previous input.
BSON is binary encoded a computer data interchange format used mainly as data storge and network transfer format in mongodb. Is based on the term json.
Inserting Docs
Documents in mongo live inside a collection. Inside shel language we see collections as properties of database.
findOne
method find one document that contains query argument
findOne(a, b), where a - what you want to find, b - what you want to display. example:
@zerin108
zerin108 / 0_reuse_code.js
Created November 6, 2015 20:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
+86937 isset
+43159 echo
+31697 empty
+29252 substr
+26146 count
+24248 is_array
+22572 strlen
+19365 sprintf
+18090 unset
+16584 str_replace
Культура программирования как раз основана на знаниях (но не только), и это основная ценность в сообществе разработчиков.