无法将js加载到MongoDB中

时间:2014-08-16 23:08:30

标签: javascript node.js angularjs macos mongodb

尝试让this project在本地运行。

已安装NPM。 Mongo正在运行,但无法加载种子文件。

使用mac OSX,终端输出为:

curtiss-mbp:CustomerManager curtiss$ mongo
MongoDB shell version: 2.7.4
connecting to: test
Server has startup warnings: 
2014-08-16T18:28:54.115-0400 [initandlisten] 
2014-08-16T18:28:54.115-0400 [initandlisten] ** NOTE: This is a development version (2.7.4) of MongoDB.
2014-08-16T18:28:54.115-0400 [initandlisten] ** Not recommended for production.
2014-08-16T18:28:54.115-0400 [initandlisten] 
2014-08-16T18:28:54.115-0400 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-08-16T18:28:54.115-0400 [initandlisten]

use custmgr
switched to db custmgr
load("initMongoCustData.js")
2014-08-16T18:40:33.956-0400 Error: remove needs a query
at Error ()
at DBCollection.remove (src/mongo/shell/collection.js:299:31)
at initMongoCustData.js:65:14
at (shell):1:1 at src/mongo/shell/collection.js:299
2014-08-16T18:40:33.956-0400 Error: error loading js file: initMongoCustData.js
at (shell):1:1

无法将js加载到MongoDB中。我错过了什么或做错了什么吗?

1 个答案:

答案 0 :(得分:3)

应该从

更改initMongoCustData.js中的

Line 65

db.customers.remove();

db.customers.remove({});