Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试一次为多个表创建索引。我目前使用 for 循环来创建这种效果,但显然我的 for 循环不起作用。
for(i=3;i<8;i++) { db.events_i.ensureIndex({userid:1, numid:1}); };
我怎样才能解决这个问题?:)
尝试这个
for(var i = 3; i < 8; i++) { db.getCollection('events_' + i).ensureIndex({userid: 1, numid: 1}); };