This file contains hidden or 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
db.getCollection('playlists').aggregate([ | |
{ $unwind: '$videos' }, | |
{ | |
$lookup: { | |
from: 'videos', | |
let: { videoId: '$videos' }, | |
pipeline: [ | |
{ $match: { $expr: { $and: [{ $eq: ['$_id', '$$videoId'] }] } } }, | |
{ | |
$lookup: { |
This file contains hidden or 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
// Tag Model | |
{ | |
_id: mongo id, | |
label: string, | |
... | |
} | |
// Video Model | |
{ | |
_id: mongo id, |
This file contains hidden or 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 { withFilter } from 'graphql-subscriptions'; | |
... | |
Subscription: { | |
watchDevice: { | |
resolve: (payload) => payload, | |
subscribe: withFilter( | |
() => pubsub.asyncIterator(deviceConstants.UPDATE_DEVICE), | |
(payload, args) => payload._id.toString() === args.id, |
This file contains hidden or 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
{ | |
"watchDevices": { | |
"type": "CREATE_DEVICE", | |
"id": "593bc92ed26159038837bd5a", | |
"name": "test create subs", | |
"updatedAt": "Sat Jun 10 2017 10:25:50 GMT+0000 (UTC)", | |
"currentLocation": { | |
"lat": 63, | |
"lng": 45.3 | |
}, |
This file contains hidden or 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
{ | |
"watchDevices": { | |
"type": "CREATE_DEVICE", | |
"id": "593bc92ed26159038837bd5a", | |
"name": "test create subs", | |
"updatedAt": "Sat Jun 10 2017 10:25:50 GMT+0000 (UTC)", | |
"currentLocation": { | |
"lat": 65, | |
"lng": 46.3 | |
}, |
This file contains hidden or 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
mutation CreateDevice($name: String! $location: LocationInput!){ | |
createDevice(name:$name location: $location) { | |
id | |
name | |
location { | |
lat | |
lng | |
} | |
} | |
} |
This file contains hidden or 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
subscription WatchDevices { | |
watchDevices { | |
type | |
id | |
name | |
updatedAt | |
currentLocation { | |
lat | |
lng | |
} |
This file contains hidden or 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
type DeviceSubscription implements MetaSubscription{ | |
type: String! | |
id: ID! | |
updatedAt: String! | |
name: String | |
currentLocation: Location | |
previousLocation: Location | |
} |
This file contains hidden or 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
{ | |
"interface": ":4984", | |
"adminInterface": ":4985", | |
"log": ["HTTP+"], | |
"databases": { | |
"db": { | |
"server": "http://couchbase-server:8091", | |
"bucket": "default", | |
"users": { "GUEST": {"disabled": false, "admin_channels": ["*"] } }, | |
"event_handlers": { |
This file contains hidden or 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
{ | |
"log": ["*"], | |
"CORS": { | |
"Origin": ["http://localhost:8000"], | |
"LoginOrigin": ["http://localhost:8000"], | |
"Headers": ["Content-Type"], | |
"MaxAge": 17280000 | |
}, | |
"databases": { | |
"db": { |