Comments (5)
Hi @aadamsx, I'm not sure to have understood. To make query to mongo, you should have a specific publication on meteor server. The added event on asteroid return an object with the keys collection, fields and id and include the element added to collection and not the entire collection.
You should save the collections somewhere in your application as plain JS object.
If you want to save in another structure, you can make your own mixin (like the asteroid-immutable-collections-mixin which convert the collections in Immutable.js).
from asteroid.
To make query to mongo, you should have a specific publication on meteor server
Yes, done that
The added event on asteroid return an object with the keys collection, fields and id and include the element added to collection and not the entire collection.
Yes, I've seen that, I get the following object for example:
collection: "People"
fields: Object
createdAt: Object
firstName: 'Test'
lastName: 'Test'
id: "asdfWkfasedf"
msg: "added"
You should save the collections somewhere in your application as plain JS object.
OK, this is the part were I fell down. So save the object in a Session variable for example?
If you want to save in another structure, you can make your own mixin (like the asteroid-immutable-collections-mixin which convert the collections in Immutable.js).
Thank you, I'll check this out.
from asteroid.
OK, this is the part were I fell down. So save the object in a Session variable for example?
Yes, something like this. For example in React application we use the redux store to save the collections.
from asteroid.
For example in React application we use the redux store to save the collections.
Right, and in Blaze we use mini-mongo. So I played with this more, and it's going to be difficult doing anything with that return object, in part I guess because I don't have a redux store.
What would be great is if I could do something like what we can do with a straight DDP connection, for example. This makes it so easy to get Collections in the proper format from the remote server!
http://stackoverflow.com/a/18360441/2547360:
var remote = DDP.connect('http://server1.com/');
Items = new Meteor.Collection('items', remote);
remote.subscribe('items', function() {
var items = Items.find();
console.log(items.count()); // get 1
});
Notice how I can take the connection and pass it to the Meteor.Collection, and from there query it acts like mini-mongo on the client (with a .find())? Is there a way to do this in Asteroid?
It seems there use to be some equivalent to this before with Asteroid:
https://www.npmjs.com/package/asteroid.browser
// Connect to a Meteor backend
var ceres = new Asteroid("localhost:3000");
// Use real-time collections
ceres.subscribe("tasksPublication");
var tasks = ceres.getCollection("tasks");
tasks.insert({
description: "Do the laundry"
});
But I can't find .getCollection()
from asteroid.
Hello guys!
I have the exact same issue as @aadamsx . Were you able to solve it?
from asteroid.
Related Issues (20)
- Methods resolve on `result` instead of `updated` event
- Is it possible to upload file using Asteroid
- User should logged out from app in other device when he reset password from any of his device
- loginWithPassword is not working in Meteor 1.4.3.1 HOT 1
- Wss connection problem while trying to connect by https HOT 5
- Questions about the state of Asteroid HOT 5
- Stopping a (global?) Subscription? HOT 2
- Disconnecting from Remote Meteor App? HOT 2
- Asteroid Publication Security HOT 1
- ReferenceError: WebSocket is not defined HOT 4
- loginWith('google') : Setting access_type offline
- when is v3 going to release? HOT 4
- is mondora/ddp.js the successor to asteroid? HOT 1
- asteroid.userId gives inconsistent returns HOT 1
- Changing endpoint dynamically. OR Re-instantiating asteroid object
- need client bundle
- Error 404 "Method login not found" HOT 2
- createUser should not send username or email in an object user.
- This project is abandoned HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asteroid.