Um aluno do Be MEAN postou essa modelagem relacional a qual ele estava com dificuldades para passar para o MongoDB, então vou ensinar aqui como faz
Vamos inicialmente separar pelas COLEÇÕES que achamos que devemos ter:
- Usuario;
- Escola;
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | |
module.exports = _dereq_('./lib/'); | |
},{"./lib/":2}],2:[function(_dereq_,module,exports){ | |
/** | |
* Module dependencies. | |
*/ |
user = { | |
name: String | |
, bio: String | |
, date_register: Date | |
, avatar_path: String | |
, auth: { | |
usenrame: String | |
, email: String | |
, password: String | |
, last_access: Date |
function doClick(e) { | |
if(OS_IOS) { | |
if(Ti.Platform.canOpenURL('Urlschemes://')) { | |
Ti.Platform.openURL('Urlschemes://'); | |
} else { | |
alert('You must install the Urlschemes app first'); | |
} | |
} else { | |
var didItWork = Ti.Platform.openURL('urlschemes://'); | |
if(!didItWork) { |
$.getView().backgroundImage = getImageFileFromSVG({ | |
image : "/images/hearts.svg", | |
width : 400, | |
height : 400, | |
top : 0, | |
left : 0 | |
}); | |
function getImageFileFromSVG(svgOpts) { | |
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, |
<?php | |
// API access key from Google API's Console ( Server KEY ) | |
define( 'API_ACCESS_KEY', 'SERVER-API-KEY' ); | |
$registrationIds = array( "userToken", "user2Token" ); | |
$nome_empresa = "Sheep Kebab"; | |
$id_push = "1"; | |
$id_empresa = "2"; | |
$abrirPush = "1"; | |
$payload = '{"id_push":'.$id_push.',"id_empresa":'.$id_empresa.', "abrir":' . $abrirPush . '}'; |
Read the blog at http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
var query = { $and : [ | |
{ idFace : { $in : [req.body.idFace] } } | |
, { "users.gender" : 'male' } | |
]} | |
; | |
Model.find( query ) | |
.populate({ | |
path : 'users.user' | |
, match : { gender : 'male' } |