Skip to content

Instantly share code, notes, and snippets.

>>> def thread_fn():
... my_db = client.get_database(
... 'test',
... read_preference=ReadPreference.SECONDARY)
{
"_id": ObjectId("523b1153a2aa6a3233a913f8"),
"requiresAuthentication": false,
"modifiedDate": ISODate("2014-08-29T17:40:22Z"),
"permanentlyRemoved": false,
"feedURL": "http://feeds.feedburner.com/eater/nyc",
"title": "Eater NY",
"bozoBitSet": false,
"enabled": true,
"etag": "4bL78iLSZud2iXd/vd10mYC32BE",
{
"_id": ObjectId("523b1153a2aa6a3233a91412"),
"description": "Buzzfeed asked a bunch of people...”,
"title": "Cronut Mania: Buzzfeed asked a bunch of people...",
"summary": "Buzzfeed asked a bunch of people that were...”,
"content": [{
"base": "http://ny.eater.com/",
"type": "text/html",
"value": ”LOTS OF HTML HERE ",
"language": "en"
{
"_id" : ObjectId("54ad6c3ae764de42070b27b1"),
"active" : true,
"email" : "[email protected]",
"firstName" : "Test",
"lastName" : "User1",
"sp_api_key_id" : "6YQB0A8VXM0X8RVDPPLRHBI7J",
"sp_api_key_secret" : "veBw/YFx56Dl0bbiVEpvbjF”,
"lastLogin" : ISODate("2015-01-07T17:26:18.996Z"),
"created" : ISODate("2015-01-07T17:26:18.995Z"),
{
"_id" : ObjectId("523b2fcc054b1b8c579bdb82"),
"read" : true,
"user_id" : ObjectId("54ad6c3ae764de42070b27b1"),
"feed_entry_id" : ObjectId("523b1153a2aa6a3233a91412"),
"feed_id" : ObjectId("523b1153a2aa6a3233a913f8")
}
{
"name": "reader-api",
"main": "server.js",
"dependencies": {
"express" : "~4.10.0",
"stormpath" : "~0.7.5", "express-stormpath" : "~0.5.9",
"mongodb" : "~1.4.26”, "mongoose" : "~3.8.0",
"body-parser" : "~1.10.0”, "method-override" : "~2.3.0",
"morgan" : "~1.5.0”, "winston" : "~0.8.3”, "express-winston" : "~0.2.9",
"validator" : "~3.27.0",
function foo() {
someAsyncFunction(params, function(err, results) {
console.log(“one”);
});
console.log(“two”);
}
actionArray = [
function one(cb) {
someAsyncFunction(params, function(err, results) {
if (err) {
cb(new Error(“There was an error”));
}
console.log(“one”);
cb(null);
});
},
MongoCursor<Document> cursor1 = coll.find().iterator();
MongoCursor<Person> cursor2 = coll.find(Person.class).iterator();
MongoCollection<Person> personColl = coll.withDocumentClass(Person.class);
MongoCursor<Person> cursor = personColl.find().iterator();