无法使用python脚本在Mongodb集合中插入文档

时间:2014-11-12 08:55:19

标签: python mongodb pymongo database

我在python中编写了一个脚本,用pymongo填充Mongodb数据库。运行脚本后,我得到以下日志:

cmd command: insert { $msg: "query not recording (too large)" } keyUpdates:0 numYields:0 locks(micros) w:48 reslen:40 175ms

通过在线研究,我发现这与Mongodb生成的两种日志的维护有关,而不是文件插入。

然后,只是为了检查,我修改了我的脚本中的以下代码

connection.dbName.collectionName.insert(document)

print connection.dbName.collectionName.insert(document)

我得到的输出,即输入文件的_id's

...
149  record entered
54636c409c2e912fbf433622
150  record entered
54636c409c2e912fbf433623
151  record entered
54636c409c2e912fbf433624
152  record entered
54636c409c2e912fbf433625
153  record entered
54636c409c2e912fbf433626
154  record entered
...

正在生成_id's,但是当我在mongo shell中使用db.collectionName.findOne()时,我得到null作为输出。 我还必须说清楚Mongodb服务器是在NUMA机器上运行的。在线查看我能够解决此问题。 请帮我解决这个问题。

更新

以下是mongo服务器的日志:

2014-11-12T21:43:36.742+0530 [conn24] allocating new ns file /data/db/db-name.ns, filling with     
zeroes...
2014-11-12T21:43:36.916+0530 [FileAllocator] allocating new datafile /data/db/db-name.0, filling   
with zeroes...
2014-11-12T21:43:36.924+0530 [FileAllocator] done allocating datafile /data/db/db-name.0, size: 
64MB,  took 0.007 secs
" }operties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "db-name.collection-name 2014-11- 
12T21:43:36.925+0530 [conn24]    added index to empty collection
query: { _id: ObjectId('546387309c2e9132e0a2f6f8'), //rest of the document} ninserted:1 
keyUpdates:0 numYields:0 locks(micros) w:183005 183ms
2014-11-12T21:43:36.925+0530 [conn24] command AVAYA-IVR.$cmd command: insert { $                                                                                              
msg: "query not recording (too large)" } keyUpdates:0 numYields:0 locks(micros)                                                                                           
w:271 reslen:40 183ms 
2014-11-12T21:43:38.100+0530 [conn24] end connection 127.0.0.1:56906 (1 connection now open)
2014-11-12T21:43:59.811+0530 [clientcursormon] mem (MB) res:42 virt:665
2014-11-12T21:43:59.811+0530 [clientcursormon]  mapped (incl journal view):480
2014-11-12T21:43:59.811+0530 [clientcursormon]  connections:1
2014-11-12T21:48:59.823+0530 [clientcursormon] mem (MB) res:43 virt:665
2014-11-12T21:48:59.823+0530 [clientcursormon]  mapped (incl journal view):480
2014-11-12T21:48:59.823+0530 [clientcursormon]  connections:1
2014-11-12T21:53:59.835+0530 [clientcursormon] mem (MB) res:43 virt:665
2014-11-12T21:53:59.835+0530 [clientcursormon]  mapped (incl journal view):480
2014-11-12T21:53:59.835+0530 [clientcursormon]  connections:1
2014-11-12T21:57:01.028+0530 [initandlisten] connection accepted from 127.0.0.1:56909 #25 (2  
connections now open)
2014-11-12T21:58:59.847+0530 [clientcursormon] mem (MB) res:42 virt:665
2014-11-12T21:58:59.847+0530 [clientcursormon]  mapped (incl journal view):480
2014-11-12T21:58:59.847+0530 [clientcursormon]  connections:2

这就是日志所说的一切。我不明白的是,日志只显示输入的第一个文档。这是我烦恼的根源吗?

0 个答案:

没有答案