Skip to content
Yu Xia edited this page Sep 9, 2015 · 10 revisions
  • SyntaxError: Unexpected token *

The code contains generator, you should use node >= v0.12 with --harmony option

  • Do complex queries (like ordering)

You can query directly from backend mongodb See connectBackend.

  • Data maintenance, update a lot of data

Data maintenance should be offline. Memdb does not support complex cross-shard queries (like find all docs). However, you can directly update backend mongodb as long as all shards are shutdown. DO NOT modify backend mongodb while any shard is running.

  • Update index on existing data

You should first shutdown all shards, and then run memdbindex to rebuild index (depend on the change), then update collection index config.

  • Error: You are not in any transaction scope

Any query by autoconnection or mdbgoose must be guarded with transaction, see autoconn.transaction. Make sure you make every query inside the transaction scope (before the main promise is resolved or rejected), this bug is usually caused by forgetting write 'yield' or 'return' before a promise.

// Oops! not in any transaction
yield Model.findByIdAsync(id); 
mdbgoose.transaction(function(){
    // Oops! yield is missing
    Model.findByIdAsync(id); 
}, 's1');
yield mdbgoose.transaction(function(){
    // This is correct
    yield Model.findByIdAsync(id); 
}, 's1');
  • Client for other programming language

Currently only nodejs client is implemented, you're encouraged to write your own language's client!

Clone this wiki locally