i'm trying to convert a collection to a capped collection, but i'm having trouble getting the s开发者_StackOverflow中文版yntax right. can someone tell me how to refer to my collection? it's full name is manage.api_requests. here is what i've tried so far:
> db.runCommand( { convertToCapped:api_requests, size: 38654705664 } )
Sat Mar 26 10:29:02 ReferenceError: api_requests is not defined (shell):1
> db.runCommand( { convertToCapped:db.api_requests, size: 38654705664 } )
{
"errmsg" : "cloneCollectionAsCapped failed: { errmsg: \"exception: source collection manage.manage.api_requests does not exist\", code: 10301, ok: 0.0 }",
"ok" : 0
}
> db.runCommand( { convertToCapped:manage.api_requests, size: 38654705664 } )
Sat Mar 26 10:42:40 ReferenceError: manage is not defined (shell):1
The collection name must be quoted of course.
You are expected to pass a string to this command. If new collection is to be called "api_requests" that pass that - including the "" - otherwise, it's not a string and the shell tries to resolve it as a variable name.
精彩评论