Skip to content

Instantly share code, notes, and snippets.

ThemeDoc.collection.find({_id: mongoose.Types.ObjectId(themeId)}, {}, {'limit': 1}).toArray(function (err, themes) {
//console.log(themes);
if (themes.length == 1) {
QuestionDoc.collection.find({'theme': mongoose.Types.ObjectId(themeId)}, {}, {'limit': 3}).toArray(function(err, questions) {
//console.log(questions);
if(questions.length == 3) {
@nihaux
nihaux / question
Last active August 29, 2015 14:13
mongoose schemas
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
_ = require('lodash'),
async = require('async');
@nihaux
nihaux / gist:05041ff4a33f0f5c7508
Created September 10, 2014 18:22
mean.js layout to test socket.io
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{title}}</title>
<!-- General META -->
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@nihaux
nihaux / gist:c02d61f6572d6531b60c
Created September 10, 2014 18:18
server.js for mean.js app with socket.io - problem
'use strict';
/**
* Module dependencies.
*/
var init = require('./config/init')(),
config = require('./config/config'),
mongoose = require('mongoose');
/**
* Main application entry file.