Hi, 
I have application in nodejs and I need to load when you start a collection 
from mongo to in-memory db. then in use only this object, not mongo 
collection.

How to make?

It occurred to me:

*TasksCollection.coffee*
class TasksCollection
  constructor: (@Tasks, @Datastore) ->

  createCollection: ->
    @Tasks.find {}, (e, tasks) ->
      return throw e if e isnt null
      @Datastore.insert tasks (e) ->
        return throw e if e isnt null
        # now I have data in in-memory db

module.exports = exports = TasksCollection

*app.coffee*
TaskMongoCollection  = ...
DataStore = ...
TasksCollection = require './TasksCollection'

new TasksCollection TaskMongoCollection, new DataStore
###
In TasksCollection should be the object of a collection of Mongo other 
methods for insertion into the collection and retrieval 

Object TaskCollection I want to pass on:
###
app.use (req, res, next) ->
  req.db = TasksCollections

###
I do not understand asynchronous work in nodejs - until we learn. 
Previously I worked in PHP so i got thinking.

Put simply: 

1). Start the application 
2). Retrieve a collection of monga into in-memory database (I use nedb) 
3). polling place in monga want to inquire into the in-memory 

Thanks
###



-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to