This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Serializable; | |
import java.nio.ByteBuffer; | |
import java.util.Arrays; | |
import java.util.UUID; | |
import javax.persistence.Access; | |
import javax.persistence.AccessType; | |
import javax.persistence.Column; | |
import javax.persistence.Embeddable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CategoryRepository.prototype.findAll = function(callback) { | |
return this.db.collection('categories', onCollectionReady); | |
function onCollectionReady(error, collection) { | |
if (error) return callback(error); | |
collection.find(onCursorReady); | |
} | |
function onCursorReady(error, cursor) { | |
console.log('onCursorReady'); | |
if (error) return callback(error, null); | |
cursor.toArray(callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongo = require('mongodb'), | |
EventEmitter = require('events').EventEmitter; | |
function Connector(settings) { | |
settings.port = settings.port || mongo.Connection.DEFAULT_PORT; | |
this.settings = settings; | |
this.server = new mongo.Server(settings.host, settings.port); | |
this.db = new mongo.Db(settings.database, this.server, {native_parser: true}); | |
} |